public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [lto] Add test case for ICE after error messages
@ 2008-11-10  3:38 Diego Novillo
  2008-11-13 12:24 ` Hans-Peter Nilsson
  0 siblings, 1 reply; 9+ messages in thread
From: Diego Novillo @ 2008-11-10  3:38 UTC (permalink / raw)
  To: gcc-patches

This used to produce a segfault after the error message for using
free on a non-heap object.  Not anymore.  Adding test to prevent
future breakage.


Diego.




	* gcc.dg/lto/20081109_0.c: New.

Index: gcc.dg/lto/20081109_0.c
===================================================================
--- gcc.dg/lto/20081109_0.c	(revision 0)
+++ gcc.dg/lto/20081109_0.c	(revision 0)
@@ -0,0 +1,3 @@
+/* { dg-do compile } */
+/* { dg-options "{-w -flto-single}" }  */
+void Foo(void) { char bar[1]; free(bar); }

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

* Re: [lto] Add test case for ICE after error messages
  2008-11-10  3:38 [lto] Add test case for ICE after error messages Diego Novillo
@ 2008-11-13 12:24 ` Hans-Peter Nilsson
  2008-11-13 13:41   ` Diego Novillo
  0 siblings, 1 reply; 9+ messages in thread
From: Hans-Peter Nilsson @ 2008-11-13 12:24 UTC (permalink / raw)
  To: Diego Novillo; +Cc: gcc-patches

On Sun, 9 Nov 2008, Diego Novillo wrote:
> +++ gcc.dg/lto/20081109_0.c	(revision 0)
> @@ -0,0 +1,3 @@
> +/* { dg-do compile } */
> +/* { dg-options "{-w -flto-single}" }  */

The curlies look redundant, if not benevolently wrong, a new
style using tcl quotes.

> +/* { dg-options "-w -flto-single" }  */

brgds, H-P

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

* Re: [lto] Add test case for ICE after error messages
  2008-11-13 12:24 ` Hans-Peter Nilsson
@ 2008-11-13 13:41   ` Diego Novillo
  2008-11-13 14:06     ` Hans-Peter Nilsson
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Diego Novillo @ 2008-11-13 13:41 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: gcc-patches

On Thu, Nov 13, 2008 at 06:36, Hans-Peter Nilsson <hp@bitrange.com> wrote:
> On Sun, 9 Nov 2008, Diego Novillo wrote:
>> +++ gcc.dg/lto/20081109_0.c   (revision 0)
>> @@ -0,0 +1,3 @@
>> +/* { dg-do compile } */
>> +/* { dg-options "{-w -flto-single}" }  */
>
> The curlies look redundant, if not benevolently wrong, a new
> style using tcl quotes.

They aren't, unfortunately.  dg-options is a list of lists.  The main
loop in lto.exp:lto-execute does 'foreach option $option_list'.
Without the braces, "-w -flto-single" would do two compiles, one with
-w and one with -flto-single.

I've been debating whether to make dg-options just a single string, as
it's fairly easy to be stung by this.  In fact, I just noticed a
couple of tests that have it wrong.  Initially, I liked the
flexibility of adding multiple sets of options.  But I think it's not
worth the confusion.


Diego.

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

* Re: [lto] Add test case for ICE after error messages
  2008-11-13 13:41   ` Diego Novillo
@ 2008-11-13 14:06     ` Hans-Peter Nilsson
  2008-11-14 18:38       ` Janis Johnson
  2008-11-14 19:32     ` Manuel López-Ibáñez
  2008-12-02 20:40     ` Mark Mitchell
  2 siblings, 1 reply; 9+ messages in thread
From: Hans-Peter Nilsson @ 2008-11-13 14:06 UTC (permalink / raw)
  To: Diego Novillo; +Cc: gcc-patches

On Thu, 13 Nov 2008, Diego Novillo wrote:
> On Thu, Nov 13, 2008 at 06:36, Hans-Peter Nilsson <hp@bitrange.com> wrote:
> > On Sun, 9 Nov 2008, Diego Novillo wrote:
> >> +++ gcc.dg/lto/20081109_0.c   (revision 0)
> >> @@ -0,0 +1,3 @@
> >> +/* { dg-do compile } */
> >> +/* { dg-options "{-w -flto-single}" }  */
> > The curlies look redundant, if not benevolently wrong, a new
> > style using tcl quotes.
>
> They aren't, unfortunately.  dg-options is a list of lists.  The main
> loop in lto.exp:lto-execute does 'foreach option $option_list'.
> Without the braces, "-w -flto-single" would do two compiles, one with
> -w and one with -flto-single.

Ah, I didn't notice it was so different from other dg-options...  Ouch.

> I've been debating whether to make dg-options just a single string, as
> it's fairly easy to be stung by this.

Or rename it to dg-multi-options or dg-torture-options or
better, maybe.

Just trying to avoid a multitude of dejagnu styles complicating
maintenance - or machine translations to something better. ;)

brgds, H-P

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

* Re: [lto] Add test case for ICE after error messages
  2008-11-13 14:06     ` Hans-Peter Nilsson
@ 2008-11-14 18:38       ` Janis Johnson
  0 siblings, 0 replies; 9+ messages in thread
From: Janis Johnson @ 2008-11-14 18:38 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: Diego Novillo, gcc-patches

On Thu, 2008-11-13 at 07:24 -0500, Hans-Peter Nilsson wrote:
> On Thu, 13 Nov 2008, Diego Novillo wrote:
> > On Thu, Nov 13, 2008 at 06:36, Hans-Peter Nilsson <hp@bitrange.com> wrote:
> > > On Sun, 9 Nov 2008, Diego Novillo wrote:
> > >> +++ gcc.dg/lto/20081109_0.c   (revision 0)
> > >> @@ -0,0 +1,3 @@
> > >> +/* { dg-do compile } */
> > >> +/* { dg-options "{-w -flto-single}" }  */
> > > The curlies look redundant, if not benevolently wrong, a new
> > > style using tcl quotes.
> >
> > They aren't, unfortunately.  dg-options is a list of lists.  The main
> > loop in lto.exp:lto-execute does 'foreach option $option_list'.
> > Without the braces, "-w -flto-single" would do two compiles, one with
> > -w and one with -flto-single.
> 
> Ah, I didn't notice it was so different from other dg-options...  Ouch.
> 
> > I've been debating whether to make dg-options just a single string, as
> > it's fairly easy to be stung by this.
> 
> Or rename it to dg-multi-options or dg-torture-options or
> better, maybe.
> 
> Just trying to avoid a multitude of dejagnu styles complicating
> maintenance - or machine translations to something better. ;)

I agree with H-P, please use a different name for your dg-options.

Janis

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

* Re: [lto] Add test case for ICE after error messages
  2008-11-13 13:41   ` Diego Novillo
  2008-11-13 14:06     ` Hans-Peter Nilsson
@ 2008-11-14 19:32     ` Manuel López-Ibáñez
  2008-12-02 20:40     ` Mark Mitchell
  2 siblings, 0 replies; 9+ messages in thread
From: Manuel López-Ibáñez @ 2008-11-14 19:32 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Hans-Peter Nilsson, gcc-patches

2008/11/13 Diego Novillo <dnovillo@google.com>:
> On Thu, Nov 13, 2008 at 06:36, Hans-Peter Nilsson <hp@bitrange.com> wrote:
>> On Sun, 9 Nov 2008, Diego Novillo wrote:
>>> +++ gcc.dg/lto/20081109_0.c   (revision 0)
>>> @@ -0,0 +1,3 @@
>>> +/* { dg-do compile } */
>>> +/* { dg-options "{-w -flto-single}" }  */
>>
>> The curlies look redundant, if not benevolently wrong, a new
>> style using tcl quotes.
>
> They aren't, unfortunately.  dg-options is a list of lists.  The main
> loop in lto.exp:lto-execute does 'foreach option $option_list'.
> Without the braces, "-w -flto-single" would do two compiles, one with
> -w and one with -flto-single.
>
> I've been debating whether to make dg-options just a single string, as
> it's fairly easy to be stung by this.  In fact, I just noticed a
> couple of tests that have it wrong.  Initially, I liked the
> flexibility of adding multiple sets of options.  But I think it's not
> worth the confusion.

I think this would be useful in general and not only for LTO testsuite
(with a different name). Couldn't it be moved to some more general
place?

As an alternative, couldn't this be implemented thought multiple
dg-options? Like:

/* { dg-do compile } */
/* { dg-options "-O1" }  */
/* { dg-options "-O2" }  */
/* { dg-options "-O3" }  */

On the other hand, perhaps an explicit new dg-command is clearer:

/* { dg-do compile } */
/* { dg-multi-options "{-O1}  {-O2}  {-O3}" }  */


Cheers,

Manuel.

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

* Re: [lto] Add test case for ICE after error messages
  2008-11-13 13:41   ` Diego Novillo
  2008-11-13 14:06     ` Hans-Peter Nilsson
  2008-11-14 19:32     ` Manuel López-Ibáñez
@ 2008-12-02 20:40     ` Mark Mitchell
  2008-12-03  0:08       ` Diego Novillo
  2 siblings, 1 reply; 9+ messages in thread
From: Mark Mitchell @ 2008-12-02 20:40 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Hans-Peter Nilsson, gcc-patches

Diego Novillo wrote:
> On Thu, Nov 13, 2008 at 06:36, Hans-Peter Nilsson <hp@bitrange.com> wrote:
>> On Sun, 9 Nov 2008, Diego Novillo wrote:
>>> +++ gcc.dg/lto/20081109_0.c   (revision 0)
>>> @@ -0,0 +1,3 @@
>>> +/* { dg-do compile } */
>>> +/* { dg-options "{-w -flto-single}" }  */
>> The curlies look redundant, if not benevolently wrong, a new
>> style using tcl quotes.
> 
> They aren't, unfortunately.  dg-options is a list of lists. 

So, why not write the list as a list?

Using Tcl braces to express a list is a trick, relying on the fact that
the fundamental datatype in Tcl is a string.  But, you can use the list
primitive to construct a list, which is more readable:

  list x "y z"

produces a list of two elements ("x" and "y z").  I would hope that
something like:

  /* { dg-options [list "-w -flto-single"] } */

would work here.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

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

* Re: [lto] Add test case for ICE after error messages
  2008-12-02 20:40     ` Mark Mitchell
@ 2008-12-03  0:08       ` Diego Novillo
  2008-12-03  0:14         ` Mark Mitchell
  0 siblings, 1 reply; 9+ messages in thread
From: Diego Novillo @ 2008-12-03  0:08 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: Hans-Peter Nilsson, gcc-patches

On Tue, Dec 2, 2008 at 15:39, Mark Mitchell <mark@codesourcery.com> wrote:

>  /* { dg-options [list "-w -flto-single"] } */

Sure, that's fine, but the issue here is the meaning of dg-options.

Usually dg-options is used for a single invocation of gcc, so {
dg-options "-O2 -fother-flag" } means

$ gcc -O2 -fother-flag file.c

For multifile tests, however, lto.exp interprets dg-options as:

$ gcc -O2 file1.c
$ gcc -fother-flag file2.c

Alternatively, lto.exp could always interpret dg-options

$ gcc -O2 -fother-flag file1.c
$ gcc -O2 -fother-flag file2.c

This would avoid the added syntactic sugar.  I think I like this way
better, actually.


Diego.

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

* Re: [lto] Add test case for ICE after error messages
  2008-12-03  0:08       ` Diego Novillo
@ 2008-12-03  0:14         ` Mark Mitchell
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Mitchell @ 2008-12-03  0:14 UTC (permalink / raw)
  To: Diego Novillo; +Cc: Hans-Peter Nilsson, gcc-patches

Diego Novillo wrote:

> For multifile tests, however, lto.exp interprets dg-options as:
> 
> $ gcc -O2 file1.c
> $ gcc -fother-flag file2.c
> 
> Alternatively, lto.exp could always interpret dg-options
> 
> $ gcc -O2 -fother-flag file1.c
> $ gcc -O2 -fother-flag file2.c

I like this better.  If we need to test different options between the
two files, let's find some other way of doing that.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

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

end of thread, other threads:[~2008-12-03  0:14 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-10  3:38 [lto] Add test case for ICE after error messages Diego Novillo
2008-11-13 12:24 ` Hans-Peter Nilsson
2008-11-13 13:41   ` Diego Novillo
2008-11-13 14:06     ` Hans-Peter Nilsson
2008-11-14 18:38       ` Janis Johnson
2008-11-14 19:32     ` Manuel López-Ibáñez
2008-12-02 20:40     ` Mark Mitchell
2008-12-03  0:08       ` Diego Novillo
2008-12-03  0:14         ` Mark Mitchell

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