public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5
@ 2011-03-25 15:30 Rainer Orth
  2011-03-25 15:39 ` Richard Guenther
  2011-04-05 22:44 ` Eric Botcazou
  0 siblings, 2 replies; 8+ messages in thread
From: Rainer Orth @ 2011-03-25 15:30 UTC (permalink / raw)
  To: gcc-patches

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

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5
  2011-03-25 15:30 [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5 Rainer Orth
@ 2011-03-25 15:39 ` Richard Guenther
  2011-03-29 18:04   ` Steve Ellcey
  2011-04-05 22:44 ` Eric Botcazou
  1 sibling, 1 reply; 8+ messages in thread
From: Richard Guenther @ 2011-03-25 15:39 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

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
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5
  2011-03-25 15:39 ` Richard Guenther
@ 2011-03-29 18:04   ` Steve Ellcey
  2011-03-29 18:22     ` Rainer Orth
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Ellcey @ 2011-03-29 18:04 UTC (permalink / raw)
  To: ro; +Cc: richard.guenther, gcc-patches

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
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]* } } */


Steve Ellcey
sje@cup.hp.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5
  2011-03-29 18:04   ` Steve Ellcey
@ 2011-03-29 18:22     ` Rainer Orth
  2011-03-29 21:10       ` Steve Ellcey
  0 siblings, 1 reply; 8+ messages in thread
From: Rainer Orth @ 2011-03-29 18:22 UTC (permalink / raw)
  To: Steve Ellcey; +Cc: richard.guenther, gcc-patches

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

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5
  2011-03-29 18:22     ` Rainer Orth
@ 2011-03-29 21:10       ` Steve Ellcey
  0 siblings, 0 replies; 8+ messages in thread
From: Steve Ellcey @ 2011-03-29 21:10 UTC (permalink / raw)
  To: Rainer Orth; +Cc: richard.guenther, gcc-patches

On Tue, 2011-03-29 at 19:50 +0200, Rainer Orth wrote:

> /* { 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

I went with the -std=gnu99 option.  Here is the final patch that I
tested and checked in:


2011-03-29  Steve Ellcey  <sje@cup.hp.com>

        * gcc.dg/torture/pr47917.c: Use -std=gnu99 on HP-UX.


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



Steve Ellcey
sje@cup.hp.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5
  2011-03-25 15:30 [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5 Rainer Orth
  2011-03-25 15:39 ` Richard Guenther
@ 2011-04-05 22:44 ` Eric Botcazou
  2011-04-05 22:54   ` Eric Botcazou
  2011-04-06  8:51   ` Rainer Orth
  1 sibling, 2 replies; 8+ messages in thread
From: Eric Botcazou @ 2011-04-05 22:44 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

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

Likewise on Solaris 8 (It's deprecated, I know, but I have access to a quite 
fast SPARC/Solaris 8 machine).

Tested on sparc-sun-solaris2.8, applied on the mainline.


2011-04-05  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc.dg/torture/pr47917.c: Add -D_XOPEN_SOURCE=500 to dg-options for
	Solaris 8 as well.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 639 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5
  2011-04-05 22:44 ` Eric Botcazou
@ 2011-04-05 22:54   ` Eric Botcazou
  2011-04-06  8:51   ` Rainer Orth
  1 sibling, 0 replies; 8+ messages in thread
From: Eric Botcazou @ 2011-04-05 22:54 UTC (permalink / raw)
  To: gcc-patches; +Cc: Rainer Orth

> 2011-04-05  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* gcc.dg/torture/pr47917.c: Add -D_XOPEN_SOURCE=500 to dg-options for
> 	Solaris 8 as well.

I somehow missed that the same change is needed on Solaris 9... Adjusted.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5
  2011-04-05 22:44 ` Eric Botcazou
  2011-04-05 22:54   ` Eric Botcazou
@ 2011-04-06  8:51   ` Rainer Orth
  1 sibling, 0 replies; 8+ messages in thread
From: Rainer Orth @ 2011-04-06  8:51 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

Eric Botcazou <ebotcazou@adacore.com> writes:

>> 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.
>
> Likewise on Solaris 8 (It's deprecated, I know, but I have access to a quite 
> fast SPARC/Solaris 8 machine).

Thanks for doing this: I meant to get to this, but am currently looking
into the same failure on Tru64 UNIX where a proper (and more general)
fix is more involved.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-04-06  8:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-25 15:30 [testsuite] Fix gcc.dg/torture/pr47917.c on IRIX 6.5 Rainer Orth
2011-03-25 15:39 ` Richard Guenther
2011-03-29 18:04   ` Steve Ellcey
2011-03-29 18:22     ` Rainer Orth
2011-03-29 21:10       ` Steve Ellcey
2011-04-05 22:44 ` Eric Botcazou
2011-04-05 22:54   ` Eric Botcazou
2011-04-06  8:51   ` Rainer Orth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).