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

login
register
mail settings
Submitter Rainer Orth
Date March 25, 2011, 3:27 p.m.
Message ID <ydd39mb8blf.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/88389/
State New
Headers show

Comments

Rainer Orth - March 25, 2011, 3:27 p.m.
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.

Tested with the appropriate runtest invocations on mips-sgi-irix6.5 and
i386-pc-solaris2.11.

Ok for mainline?

	Rainer


2011-03-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* gcc.dg/torture/pr47917.c: Add -D_XOPEN_SOURCE=500 to dg-options
	for mips-sgi-irix6.5.
	Replace snprintf prototype by <stdio.h>.
Richard Guenther - March 25, 2011, 3:35 p.m.
On Fri, Mar 25, 2011 at 4:27 PM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> 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.
>
> Tested with the appropriate runtest invocations on mips-sgi-irix6.5 and
> i386-pc-solaris2.11.
>
> Ok for mainline?

Ok.

Thanks,
Richard.

>        Rainer
>
>
> 2011-03-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
>        * gcc.dg/torture/pr47917.c: Add -D_XOPEN_SOURCE=500 to dg-options
>        for mips-sgi-irix6.5.
>        Replace snprintf prototype by <stdio.h>.
>
> diff -r b835af6cfe0b gcc/testsuite/gcc.dg/torture/pr47917.c
> --- a/gcc/testsuite/gcc.dg/torture/pr47917.c    Thu Mar 24 20:35:54 2011 +0100
> +++ b/gcc/testsuite/gcc.dg/torture/pr47917.c    Fri Mar 25 16:21:55 2011 +0100
> @@ -1,11 +1,12 @@
>  /* { dg-do run } */
>  /* { dg-options "-std=c99" } */
> +/* { dg-options "-std=c99 -D_XOPEN_SOURCE=500" { target mips-sgi-irix6.5 } } */
>  /* { dg-xfail-if "no C99 snprintf function" { *-*-hpux10* } } */
>  /* { dg-xfail-run-if "non-conforming C99 snprintf" { *-*-hpux11.[012]* } } */
>
>  /* PR middle-end/47917 */
>
> -extern int snprintf (char *, __SIZE_TYPE__, const char *, ...);
> +#include <stdio.h>
>  extern int memcmp (const void *, const void *, __SIZE_TYPE__);
>  extern void abort (void);
>
> --
> -----------------------------------------------------------------------------
> Rainer Orth, Center for Biotechnology, Bielefeld University
>

Patch

diff -r b835af6cfe0b gcc/testsuite/gcc.dg/torture/pr47917.c
--- a/gcc/testsuite/gcc.dg/torture/pr47917.c	Thu Mar 24 20:35:54 2011 +0100
+++ b/gcc/testsuite/gcc.dg/torture/pr47917.c	Fri Mar 25 16:21:55 2011 +0100
@@ -1,11 +1,12 @@ 
 /* { dg-do run } */
 /* { dg-options "-std=c99" } */
+/* { dg-options "-std=c99 -D_XOPEN_SOURCE=500" { target mips-sgi-irix6.5 } } */
 /* { dg-xfail-if "no C99 snprintf function" { *-*-hpux10* } } */
 /* { dg-xfail-run-if "non-conforming C99 snprintf" { *-*-hpux11.[012]* } } */
 
 /* PR middle-end/47917 */
 
-extern int snprintf (char *, __SIZE_TYPE__, const char *, ...);
+#include <stdio.h>
 extern int memcmp (const void *, const void *, __SIZE_TYPE__);
 extern void abort (void);