This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix gcc.c-torture/execute/stdarg-2.c
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 3 Nov 2004 21:56:30 +0100
- Subject: [PATCH] Fix gcc.c-torture/execute/stdarg-2.c
Hello,
The testcase is miscompiled on the SPARC because of the following construct:
foo_arg = va_arg (ap, int) + va_arg (ap, double);
I think it is not valid ISO C because ap is modified twice without an
intervening sequence point.
OK for mainline?
2004-11-03 ?Eric Botcazou ?<ebotcazou@libertysurf.fr>
* gcc.c-torture/execute/stdarg-2.c (foo): Split multiple
invocations of va_arg.
--
Eric Botcazou
Index: gcc.c-torture/execute/stdarg-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.c-torture/execute/stdarg-2.c,v
retrieving revision 1.1
diff -u -p -r1.1 stdarg-2.c
--- gcc.c-torture/execute/stdarg-2.c 29 Sep 2004 09:47:55 -0000 1.1
+++ gcc.c-torture/execute/stdarg-2.c 3 Nov 2004 20:52:39 -0000
@@ -13,14 +13,17 @@ foo (int v, va_list ap)
switch (v)
{
case 5:
- foo_arg = va_arg (ap, int) + va_arg (ap, double);
+ foo_arg = va_arg (ap, int);
+ foo_arg += va_arg (ap, double);
foo_arg += va_arg (ap, long long);
break;
case 8:
- foo_arg = va_arg (ap, long long) + va_arg (ap, double);
+ foo_arg = va_arg (ap, long long);
+ foo_arg += va_arg (ap, double);
break;
case 11:
- foo_arg = va_arg (ap, int) + va_arg (ap, long double);
+ foo_arg = va_arg (ap, int);
+ foo_arg += va_arg (ap, long double);
break;
default:
abort ();