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.};

Reply via email to