diff mbox

[testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5

Message ID 201103291728.p2THScM13587@lucas.cup.hp.com
State New
Headers show

Commit Message

Steve Ellcey March 29, 2011, 5:28 p.m. UTC
On Fri, Mar 25, 2011 at 4:27 PM, Rainer Orth wrote:
> The new gcc.dg/torture/pr47917.c test currently fails the execution test
> on IRIX 6.5.  To get a C99-conformant snprintf, one needs to include
> <stdio.h> with _XOPEN_SOURCE defined as 500.  The following patch does
> this.

Rainer,

This patch re-broke pr47917.c on HP-UX because it doesn't see the
snprintf prototype in stdio.h when using -std=c99.  I do see it if I use
-std=gnu99 instead and that is what I probably should have used in the
first place.  I was wondering if using -std=gnu99 would also work for
mips-sgi-irix6.5 in place of "-std=c99 -D_XOPEN_SOURCE=500".

If so I would propose this patch to just use -std=gnu99 for all
platforms:

$ svn diff gcc.dg/torture/pr47917.c

Steve Ellcey
sje@cup.hp.com

Comments

Rainer Orth March 29, 2011, 5:50 p.m. UTC | #1
Steve,

> This patch re-broke pr47917.c on HP-UX because it doesn't see the
> snprintf prototype in stdio.h when using -std=c99.  I do see it if I use

sorry for that.  I noticed later that this standards-conformant snprintf
business is a total mess on several platforms (e.g. it also fails on
Tru64 UNIX, but there needs _ISO_C_SOURCE=19990L to enable ;-)

> -std=gnu99 instead and that is what I probably should have used in the
> first place.  I was wondering if using -std=gnu99 would also work for
> mips-sgi-irix6.5 in place of "-std=c99 -D_XOPEN_SOURCE=500".

No, unfortunately not: only the XPG5 version of snprintf works on IRIX 6.5.

> If so I would propose this patch to just use -std=gnu99 for all
> platforms:
>
> $ svn diff gcc.dg/torture/pr47917.c
> Index: gcc.dg/torture/pr47917.c
> ===================================================================
> --- gcc.dg/torture/pr47917.c    (revision 171649)
> +++ gcc.dg/torture/pr47917.c    (working copy)
> @@ -1,6 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-std=c99" } */
> -/* { dg-options "-std=c99 -D_XOPEN_SOURCE=500" { target mips-sgi-irix6.5 } } */
> +/* { dg-options "-std=gnu99" } */
>  /* { dg-xfail-if "no C99 snprintf function" { *-*-hpux10* } } */
>  /* { dg-xfail-run-if "non-conforming C99 snprintf" { *-*-hpux11.[012]* } } */

Sorry, this won't work.  I fear we'll have to add another dg-options
clause for HP-UX here:

/* { dg-options "-std=gnu99" { target *-*-hpux* } } */

Alternatively, the mips-sgi-irix6.5 variant might work, too.  Either
patch is preapproved if this works for you.

Thanks.
	Rainer
diff mbox

Patch

Index: gcc.dg/torture/pr47917.c
===================================================================
--- gcc.dg/torture/pr47917.c    (revision 171649)
+++ gcc.dg/torture/pr47917.c    (working copy)
@@ -1,6 +1,5 @@ 
 /* { dg-do run } */
-/* { dg-options "-std=c99" } */
-/* { dg-options "-std=c99 -D_XOPEN_SOURCE=500" { target mips-sgi-irix6.5 } } */
+/* { dg-options "-std=gnu99" } */
 /* { dg-xfail-if "no C99 snprintf function" { *-*-hpux10* } } */
 /* { dg-xfail-run-if "non-conforming C99 snprintf" { *-*-hpux11.[012]* } } */