Patchwork [testsuite] Fix gcc.dg/torture/pr47917.c on Tru64 UNIX V5.1

login
register
mail settings
Submitter Rainer Orth
Date April 11, 2011, 6:19 p.m.
Message ID <ydd1v18zm44.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/90630/
State New
Headers show

Comments

Rainer Orth - April 11, 2011, 6:19 p.m.
As on several platforms, gcc.dg/torture/pr47917.c was failing on Tru64
UNIX V5.1.  To get a standards-conformant snprintf (and vsnprintf), one
needs to define _ISO_C_SOURCE=19990L (sic!).  Initially, I tried to
solve the problem in a general way by always defining that macro with
-stdc=c99|gnu99, but that opened a can of worms: if that macro is
defined, many other feature test macros like _XOPEN_SOURCE,
POSIX_SOURCE, _OSF_SOURCE are gone and bootstrap fails all over
(i.e. any target library which depends on C99 features like libgfortran,
libjava, and libstdc++).  The seems to be no way to do this properly, so
I've chosen the easy way out and define the macro just for the single
testcase. 

Tested with the appropriate runtest invocation, installed on mainline.

	Rainer


2011-04-11  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* gcc.dg/torture/pr47917.c: Define _ISO_C_SOURCE=19990L for
	alpha*-dec-osf5*.

Patch

Index: gcc/testsuite/gcc.dg/torture/pr47917.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr47917.c	(revision 172269)
+++ gcc/testsuite/gcc.dg/torture/pr47917.c	(revision 172270)
@@ -1,5 +1,6 @@ 
 /* { dg-do run } */
 /* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -D_ISO_C_SOURCE=19990L" { target alpha*-dec-osf5* } } */
 /* { dg-options "-std=c99 -D_XOPEN_SOURCE=500" { target mips-sgi-irix6.5 *-*-solaris2.[89] } } */
 /* { dg-options "-std=gnu99" { target *-*-hpux* } } */
 /* { dg-xfail-if "no C99 snprintf function" { *-*-hpux10* } } */
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 172269)
+++ gcc/testsuite/ChangeLog	(revision 172270)
@@ -1,3 +1,8 @@ 
+2011-04-11  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+	* gcc.dg/torture/pr47917.c: Define _ISO_C_SOURCE=19990L for
+	alpha*-dec-osf5*.
+
 2011-04-11  Martin Jambor  <mjambor@suse.cz>
 
 	PR tree-optimization/48195