From patchwork Mon Jan 23 19:13:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 137456 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 7F3BFB6FA8 for ; Tue, 24 Jan 2012 06:14:29 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1327950870; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Mail-Followup-To:Subject:Date:Message-ID: User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=m9Xh0/3eY2wGRBsHzQd43a/CLqM=; b=WikR//RZBBsjxnd i2d4rcRcvFqikM13B6zFKFEbaWw90vgq01iGIL1GiHpYwGJ5L5PZjlcy8vAPpttL z/pTFVVc9AvADg+4ChisIX1x/EZO2avS8oh18SN71+CENPjjnJ3bNPN+iq7uoM3R BKOKFWz7JBVpXs35zLHDo8uROPrk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Mail-Followup-To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ePvGlcgq9UPMQn4G1Ug4NPaJ1SpU1Pr/1M/+YxqtmziCXM0S7pj7rSzmudHH5P 36KkJvqTWLbCRUu4NyUaD6CNgJrgxUuhYN+7qUgyDFA4W5oDn1S8sLHuQOubuIge GDlnMRW6eoU1dX6345zdVso1oAPiOXz5SnbU4nnJ4aMkE=; Received: (qmail 17350 invoked by alias); 23 Jan 2012 19:14:26 -0000 Received: (qmail 17340 invoked by uid 22791); 23 Jan 2012 19:14:25 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Jan 2012 19:14:12 +0000 Received: by wgbdy1 with SMTP id dy1so2890498wgb.8 for ; Mon, 23 Jan 2012 11:14:11 -0800 (PST) Received: by 10.180.96.230 with SMTP id dv6mr15562526wib.11.1327346051550; Mon, 23 Jan 2012 11:14:11 -0800 (PST) Received: from localhost (rsandifo.gotadsl.co.uk. [82.133.89.107]) by mx.google.com with ESMTPS id eq5sm44186234wib.2.2012.01.23.11.14.09 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Jan 2012 11:14:10 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [testsuite] Avoid assuming argc != 0 Date: Mon, 23 Jan 2012 19:13:53 +0000 Message-ID: <8739b6fczy.fsf@firetop.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org gcc.c-torture/execute/scal-to-vec1.c uses "argc" as an easy way of injecting a runtime value into a constructor. The test goes on to do divide by this value, so it cannot be zero. This causes problems on embedded targets that don't provide a command line, and that instead set argc to 0. One fix is attached. Another would be to read from a volatile variable that has been initialised to 1. Other possibilities exist too of course. Tested on mipsisa64-elf. OK to install? Richard gcc/testsuite/ * gcc.c-torture/execute/scal-to-vec1.c (main): Allow argc to be 0. Index: gcc/testsuite/gcc.c-torture/execute/scal-to-vec1.c =================================================================== --- gcc/testsuite/gcc.c-torture/execute/scal-to-vec1.c 2012-01-23 19:05:52.000000000 +0000 +++ gcc/testsuite/gcc.c-torture/execute/scal-to-vec1.c 2012-01-23 19:05:59.000000000 +0000 @@ -30,7 +30,7 @@ #define fvec_2 (vector(4, float)){2., 2. #define dvec_2 (vector(2, double)){2., 2.} - vector(8, short) v0 = {argc, 1,2,3,4,5,6,7}; + vector(8, short) v0 = {argc | 1, 1,2,3,4,5,6,7}; vector(8, short) v1; vector(4, float) f0 = {1., 2., 3., 4.};