public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]: Fix missed PRE optimization discovered
@ 2008-10-16 23:29 Daniel Berlin
  2008-10-17 13:05 ` Andreas Schwab
  0 siblings, 1 reply; 29+ messages in thread
From: Daniel Berlin @ 2008-10-16 23:29 UTC (permalink / raw)
  To: GCC Patches

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

The attached fixes a missed optimization in PRE noticed by richard guenther.

We weren't caching phi translation results if they were constants,
which would cause us to fail to optimize things like:


int main(int argc)
{
int i;

if (argc)
  i = 5;
else
  i = 9;
 y = __builtin_pow(i, i);
 return y;
}

the result of phi translation would end up being constant, and we
would throw it away, which would cause us to assume phi translation
had failed.
Fixed by also adding constants to the phi translation table.
This is a regression from 4.3 for some cases, so i am committing it to mainline.

Bootstrapped and regtested on i686-darwin, committed.
2008-10-16  Daniel Berlin  <dberlin@dberlin.org>

	* tree-ssa-pre.c (phi_translate_set): Add constants to phi
	translation cache.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: premissed.diff --]
[-- Type: text/x-patch; name=premissed.diff, Size: 645 bytes --]

diff -r 2b8e288bbb69 gcc/tree-ssa-pre.c
--- a/gcc/tree-ssa-pre.c	Wed Oct 15 16:48:13 2008 +0000
+++ b/gcc/tree-ssa-pre.c	Thu Oct 16 18:22:34 2008 -0400
@@ -1745,9 +1745,8 @@
       pre_expr translated;
       translated = phi_translate (expr, set, NULL, pred, phiblock);
 
-      /* Don't add constants or empty translations to the cache, since
-	 we won't look them up that way, or use the result, anyway.  */
-      if (translated && !value_id_constant_p (get_expr_value_id (translated)))
+      /* Don't add empty translations to the cache  */
+      if (translated)
 	phi_trans_add (expr, translated, pred);
 
       if (translated != NULL)

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-16 23:29 [PATCH]: Fix missed PRE optimization discovered Daniel Berlin
@ 2008-10-17 13:05 ` Andreas Schwab
  2008-10-17 13:08   ` Eric Botcazou
  0 siblings, 1 reply; 29+ messages in thread
From: Andreas Schwab @ 2008-10-17 13:05 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: GCC Patches

"Daniel Berlin" <dberlin@dberlin.org> writes:

> Bootstrapped and regtested on i686-darwin, committed.
> 2008-10-16  Daniel Berlin  <dberlin@dberlin.org>
>
> 	* tree-ssa-pre.c (phi_translate_set): Add constants to phi
> 	translation cache.

This breaks Ada on ia64:

Starting program: /tmp/cvs/test/gcc-test-r141182/Build/gcc/gnat1 -I./ -I../rts -I. -I/tmp/cvs/test/gcc-test-r141182/gcc/ada -I- -quiet -dumpbase gnatname.adb -O2 -g -gnatpg -gnata /tmp/cvs/test/gcc-test-r141182/gcc/ada/gnatname.adb

Program received signal SIGSEGV, Segmentation fault.
0x4000000000f4a071 in bitmap_find_leader (set=0x6000000000b6b748, 
    val=<value optimized out>, stmt=0x0) at ../../gcc/bitmap.h:226
226       bi->elt1 = map->first;
(gdb) bt
#0  0x4000000000f4a071 in bitmap_find_leader (set=0x6000000000b6b748, 
    val=<value optimized out>, stmt=0x0) at ../../gcc/bitmap.h:226
#1  0x4000000000f54580 in insert_aux (block=0x200000000178d260)
    at ../../gcc/tree-ssa-pre.c:3265
#2  0x4000000000f53f50 in insert_aux (block=0x200000000178cd80)
    at ../../gcc/tree-ssa-pre.c:3471
#3  0x4000000000f53f50 in insert_aux (block=0x200000000178c120)
    at ../../gcc/tree-ssa-pre.c:3471
#4  0x4000000000f53f50 in insert_aux (block=0x2000000001757b40)
    at ../../gcc/tree-ssa-pre.c:3471
#5  0x4000000000f53f50 in insert_aux (block=0x20000000013c4360)
    at ../../gcc/tree-ssa-pre.c:3471
#6  0x4000000000f53f50 in insert_aux (block=0x200000000083bae0)
    at ../../gcc/tree-ssa-pre.c:3471
#7  0x4000000000f5a810 in execute_pre (do_fre=<value optimized out>)
    at ../../gcc/tree-ssa-pre.c:3492
#8  0x4000000000f5a960 in do_pre () at ../../gcc/tree-ssa-pre.c:4295
#9  0x4000000000b83390 in execute_one_pass (pass=0x600000000008cf98)
    at ../../gcc/passes.c:1279
#10 0x4000000000b83a10 in execute_pass_list (pass=0x600000000008cf98)
    at ../../gcc/passes.c:1327
#11 0x4000000000b83a60 in execute_pass_list (pass=0x600000000008be70)
    at ../../gcc/passes.c:1328
#12 0x4000000000ddbff0 in tree_rest_of_compilation (fndecl=0x2000000000662400)
    at ../../gcc/tree-optimize.c:418
#13 0x400000000112d160 in cgraph_expand_function (node=0x20000000013bd000)
    at ../../gcc/cgraphunit.c:1038
#14 0x4000000001131c60 in cgraph_optimize () at ../../gcc/cgraphunit.c:1097
#15 0x400000000004cc80 in gnat_write_global_declarations ()
    at ../../gcc/ada/gcc-interface/utils.c:4821
#16 0x4000000000d17ad0 in toplev_main (argc=<value optimized out>, 
    argv=<value optimized out>) at ../../gcc/toplev.c:979
#17 0x40000000007b3d60 in main (argc=14, argv=0x607ffffffec2a698)
    at ../../gcc/main.c:35

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-17 13:05 ` Andreas Schwab
@ 2008-10-17 13:08   ` Eric Botcazou
  2008-10-17 15:41     ` Daniel Berlin
  0 siblings, 1 reply; 29+ messages in thread
From: Eric Botcazou @ 2008-10-17 13:08 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches, Daniel Berlin

> This breaks Ada on ia64:

This breaks Ada everywhere.

-- 
Eric Botcazou

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-17 13:08   ` Eric Botcazou
@ 2008-10-17 15:41     ` Daniel Berlin
  2008-10-17 17:08       ` Daniel Berlin
  0 siblings, 1 reply; 29+ messages in thread
From: Daniel Berlin @ 2008-10-17 15:41 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Andreas Schwab, gcc-patches

On Fri, Oct 17, 2008 at 6:59 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> This breaks Ada on ia64:
>
> This breaks Ada everywhere.
>

I'll take a look this morning.
There is no good reason this should break anything.

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-17 15:41     ` Daniel Berlin
@ 2008-10-17 17:08       ` Daniel Berlin
  2008-10-17 17:56         ` Daniel Berlin
  2008-10-17 19:08         ` Eric Botcazou
  0 siblings, 2 replies; 29+ messages in thread
From: Daniel Berlin @ 2008-10-17 17:08 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Andreas Schwab, gcc-patches

On Fri, Oct 17, 2008 at 10:33 AM, Daniel Berlin <dberlin@dberlin.org> wrote:
> On Fri, Oct 17, 2008 at 6:59 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>>> This breaks Ada on ia64:
>>
>> This breaks Ada everywhere.
>>
>
> I'll take a look this morning.
> There is no good reason this should break anything.
>

Doesn't break on x86_64-linux-gnu for me (ubuntu hardy), trying
i686-pc-linux-gnu.

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-17 17:08       ` Daniel Berlin
@ 2008-10-17 17:56         ` Daniel Berlin
  2008-10-17 19:08         ` Eric Botcazou
  1 sibling, 0 replies; 29+ messages in thread
From: Daniel Berlin @ 2008-10-17 17:56 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Andreas Schwab, gcc-patches

On Fri, Oct 17, 2008 at 11:14 AM, Daniel Berlin <dberlin@dberlin.org> wrote:
> On Fri, Oct 17, 2008 at 10:33 AM, Daniel Berlin <dberlin@dberlin.org> wrote:
>> On Fri, Oct 17, 2008 at 6:59 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>>>> This breaks Ada on ia64:
>>>
>>> This breaks Ada everywhere.
>>>
>>
>> I'll take a look this morning.
>> There is no good reason this should break anything.
>>
>
> Doesn't break on x86_64-linux-gnu for me (ubuntu hardy), trying
> i686-pc-linux-gnu.
>
Okay, i reproduced this on i686-pc-linux-gnu.
It looks like we forget to add a constant to the expression set
somewhere (which is a latent bug).
Fix coming soon.

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-17 17:08       ` Daniel Berlin
  2008-10-17 17:56         ` Daniel Berlin
@ 2008-10-17 19:08         ` Eric Botcazou
  2008-10-17 22:24           ` Daniel Berlin
  2008-10-17 22:46           ` Laurent GUERBY
  1 sibling, 2 replies; 29+ messages in thread
From: Eric Botcazou @ 2008-10-17 19:08 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: Andreas Schwab, gcc-patches

> Doesn't break on x86_64-linux-gnu for me (ubuntu hardy), trying
> i686-pc-linux-gnu.

Really sure?  Our x86 and x86-64 testers are down and Laurent Guerby's tester 
on x86-64 hasn't posted anything to gcc-results@ since rev 141181.

-- 
Eric Botcazou

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-17 19:08         ` Eric Botcazou
@ 2008-10-17 22:24           ` Daniel Berlin
  2008-10-17 22:46           ` Laurent GUERBY
  1 sibling, 0 replies; 29+ messages in thread
From: Daniel Berlin @ 2008-10-17 22:24 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Andreas Schwab, gcc-patches

On Fri, Oct 17, 2008 at 1:17 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Doesn't break on x86_64-linux-gnu for me (ubuntu hardy), trying
>> i686-pc-linux-gnu.
>
> Really sure?  Our x86 and x86-64 testers are down and Laurent Guerby's tester
> on x86-64 hasn't posted anything to gcc-results@ since rev 141181.

I'll try it again.
(not that it matters since i can repro on i686)

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-17 19:08         ` Eric Botcazou
  2008-10-17 22:24           ` Daniel Berlin
@ 2008-10-17 22:46           ` Laurent GUERBY
  2008-10-18 10:28             ` Daniel Berlin
  1 sibling, 1 reply; 29+ messages in thread
From: Laurent GUERBY @ 2008-10-17 22:46 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Daniel Berlin, Andreas Schwab, gcc-patches

On Fri, 2008-10-17 at 19:17 +0200, Eric Botcazou wrote:
> > Doesn't break on x86_64-linux-gnu for me (ubuntu hardy), trying
> > i686-pc-linux-gnu.
> 
> Really sure?  Our x86 and x86-64 testers are down and Laurent Guerby's tester 
> on x86-64 hasn't posted anything to gcc-results@ since rev 141181.

I confirm 141181 was the last to bootstrap c,ada on x86_64,
the next update of the build script led to a failure:

Fri Oct 17 04:18:33 CEST 2008
Updating SVN tree
U    gcc/DATESTAMP
U    gcc/ChangeLog
U    gcc/tree-ssa-pre.c
Updated to revision 141186.
...

raised STORAGE_ERROR : stack overflow (or erroneous memory access)
gnatmake: "/home/guerby/trunk/gcc/ada/gnatname.adb" compilation error
make[3]: *** [common-tools] Error 4
make[3]: Leaving directory `/home/guerby/build/gcc/ada/tools'
make[2]: *** [gnattools-native] Error 2
make[2]: Leaving directory `/home/guerby/build/gnattools'
make[1]: *** [all-gnattools] Error 2
make[1]: Leaving directory `/home/guerby/build'
make: *** [bootstrap] Error 2
Fri Oct 17 06:22:24 CEST 2008

For reference, the configure line of my build script is:

../trunk/configure --prefix=/n/11/guerby/install-trunk
--enable-languages=c,ada --enable-__cxa_atexit --disable-nls
--enable-threads=posix --with-mpfr=/opt/cfarm/mpfr-2.3.1

And base version of GCC is "4.1.2 20061115 (prerelease) (Debian
4.1.1-21)".

Laurent


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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-17 22:46           ` Laurent GUERBY
@ 2008-10-18 10:28             ` Daniel Berlin
  2008-10-18 18:03               ` Richard Guenther
  0 siblings, 1 reply; 29+ messages in thread
From: Daniel Berlin @ 2008-10-18 10:28 UTC (permalink / raw)
  To: Laurent GUERBY; +Cc: Eric Botcazou, Andreas Schwab, gcc-patches

I'm currently testing the following, which at least doesn't crash on
the minimized testcase i produced :)


Index: tree-ssa-pre.c
===================================================================
--- tree-ssa-pre.c	(revision 141195)
+++ tree-ssa-pre.c	(working copy)
@@ -3022,21 +3022,13 @@
 	  if (TREE_TYPE (constant) != type)
 	    {
 	      tree builtexpr = fold_convert (type, constant);
-	      if (is_gimple_min_invariant (builtexpr))
+	      if (!is_gimple_min_invariant (builtexpr))
 		{
-		  PRE_EXPR_CONSTANT (eprime) = builtexpr;
-		}
-	      else
-		{
 		  tree forcedexpr = force_gimple_operand (builtexpr,
 							  &stmts, true,
 							  NULL);
-		  if (is_gimple_min_invariant (forcedexpr))
+		  if (!is_gimple_min_invariant (forcedexpr))
 		    {
-		      PRE_EXPR_CONSTANT (eprime) = forcedexpr;
-		    }
-		  else
-		    {
 		      if (forcedexpr != builtexpr)
 			{
 			  VN_INFO_GET (forcedexpr)->valnum = PRE_EXPR_CONSTANT (eprime);


On Fri, Oct 17, 2008 at 2:34 PM, Laurent GUERBY <laurent@guerby.net> wrote:
> On Fri, 2008-10-17 at 19:17 +0200, Eric Botcazou wrote:
>> > Doesn't break on x86_64-linux-gnu for me (ubuntu hardy), trying
>> > i686-pc-linux-gnu.
>>
>> Really sure?  Our x86 and x86-64 testers are down and Laurent Guerby's tester
>> on x86-64 hasn't posted anything to gcc-results@ since rev 141181.
>
> I confirm 141181 was the last to bootstrap c,ada on x86_64,
> the next update of the build script led to a failure:
>
> Fri Oct 17 04:18:33 CEST 2008
> Updating SVN tree
> U    gcc/DATESTAMP
> U    gcc/ChangeLog
> U    gcc/tree-ssa-pre.c
> Updated to revision 141186.
> ...
>
> raised STORAGE_ERROR : stack overflow (or erroneous memory access)
> gnatmake: "/home/guerby/trunk/gcc/ada/gnatname.adb" compilation error
> make[3]: *** [common-tools] Error 4
> make[3]: Leaving directory `/home/guerby/build/gcc/ada/tools'
> make[2]: *** [gnattools-native] Error 2
> make[2]: Leaving directory `/home/guerby/build/gnattools'
> make[1]: *** [all-gnattools] Error 2
> make[1]: Leaving directory `/home/guerby/build'
> make: *** [bootstrap] Error 2
> Fri Oct 17 06:22:24 CEST 2008
>
> For reference, the configure line of my build script is:
>
> ../trunk/configure --prefix=/n/11/guerby/install-trunk
> --enable-languages=c,ada --enable-__cxa_atexit --disable-nls
> --enable-threads=posix --with-mpfr=/opt/cfarm/mpfr-2.3.1
>
> And base version of GCC is "4.1.2 20061115 (prerelease) (Debian
> 4.1.1-21)".
>
> Laurent
>
>
>

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-18 10:28             ` Daniel Berlin
@ 2008-10-18 18:03               ` Richard Guenther
  2008-10-18 18:05                 ` Richard Guenther
  2008-10-18 23:04                 ` Daniel Berlin
  0 siblings, 2 replies; 29+ messages in thread
From: Richard Guenther @ 2008-10-18 18:03 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: Laurent GUERBY, Eric Botcazou, Andreas Schwab, gcc-patches

On Sat, Oct 18, 2008 at 4:02 AM, Daniel Berlin <dberlin@dberlin.org> wrote:
> I'm currently testing the following, which at least doesn't crash on
> the minimized testcase i produced :)

Looking at that patch I wonder if

-          if (TREE_TYPE (constant) != type)
+         if (!useless_type_conversion_p (type, TREE_TYPE (constant)))

will also work.

Richard.

>
> Index: tree-ssa-pre.c
> ===================================================================
> --- tree-ssa-pre.c      (revision 141195)
> +++ tree-ssa-pre.c      (working copy)
> @@ -3022,21 +3022,13 @@
>          if (TREE_TYPE (constant) != type)
>            {
>              tree builtexpr = fold_convert (type, constant);
> -             if (is_gimple_min_invariant (builtexpr))
> +             if (!is_gimple_min_invariant (builtexpr))
>                {
> -                 PRE_EXPR_CONSTANT (eprime) = builtexpr;
> -               }
> -             else
> -               {
>                  tree forcedexpr = force_gimple_operand (builtexpr,
>                                                          &stmts, true,
>                                                          NULL);
> -                 if (is_gimple_min_invariant (forcedexpr))
> +                 if (!is_gimple_min_invariant (forcedexpr))
>                    {
> -                     PRE_EXPR_CONSTANT (eprime) = forcedexpr;
> -                   }
> -                 else
> -                   {
>                      if (forcedexpr != builtexpr)
>                        {
>                          VN_INFO_GET (forcedexpr)->valnum = PRE_EXPR_CONSTANT (eprime);
>
>
> On Fri, Oct 17, 2008 at 2:34 PM, Laurent GUERBY <laurent@guerby.net> wrote:
>> On Fri, 2008-10-17 at 19:17 +0200, Eric Botcazou wrote:
>>> > Doesn't break on x86_64-linux-gnu for me (ubuntu hardy), trying
>>> > i686-pc-linux-gnu.
>>>
>>> Really sure?  Our x86 and x86-64 testers are down and Laurent Guerby's tester
>>> on x86-64 hasn't posted anything to gcc-results@ since rev 141181.
>>
>> I confirm 141181 was the last to bootstrap c,ada on x86_64,
>> the next update of the build script led to a failure:
>>
>> Fri Oct 17 04:18:33 CEST 2008
>> Updating SVN tree
>> U    gcc/DATESTAMP
>> U    gcc/ChangeLog
>> U    gcc/tree-ssa-pre.c
>> Updated to revision 141186.
>> ...
>>
>> raised STORAGE_ERROR : stack overflow (or erroneous memory access)
>> gnatmake: "/home/guerby/trunk/gcc/ada/gnatname.adb" compilation error
>> make[3]: *** [common-tools] Error 4
>> make[3]: Leaving directory `/home/guerby/build/gcc/ada/tools'
>> make[2]: *** [gnattools-native] Error 2
>> make[2]: Leaving directory `/home/guerby/build/gnattools'
>> make[1]: *** [all-gnattools] Error 2
>> make[1]: Leaving directory `/home/guerby/build'
>> make: *** [bootstrap] Error 2
>> Fri Oct 17 06:22:24 CEST 2008
>>
>> For reference, the configure line of my build script is:
>>
>> ../trunk/configure --prefix=/n/11/guerby/install-trunk
>> --enable-languages=c,ada --enable-__cxa_atexit --disable-nls
>> --enable-threads=posix --with-mpfr=/opt/cfarm/mpfr-2.3.1
>>
>> And base version of GCC is "4.1.2 20061115 (prerelease) (Debian
>> 4.1.1-21)".
>>
>> Laurent
>>
>>
>>
>

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-18 18:03               ` Richard Guenther
@ 2008-10-18 18:05                 ` Richard Guenther
  2008-10-18 23:04                 ` Daniel Berlin
  1 sibling, 0 replies; 29+ messages in thread
From: Richard Guenther @ 2008-10-18 18:05 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: Laurent GUERBY, Eric Botcazou, Andreas Schwab, gcc-patches

On Sat, Oct 18, 2008 at 12:27 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Oct 18, 2008 at 4:02 AM, Daniel Berlin <dberlin@dberlin.org> wrote:
>> I'm currently testing the following, which at least doesn't crash on
>> the minimized testcase i produced :)
>
> Looking at that patch I wonder if
>
> -          if (TREE_TYPE (constant) != type)
> +         if (!useless_type_conversion_p (type, TREE_TYPE (constant)))
>
> will also work.

Btw, I agree that stuff like

   PRE_EXPR_CONSTANT (eprime) = builtexpr;

is probably not a good idea ;)

Richard.

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-18 18:03               ` Richard Guenther
  2008-10-18 18:05                 ` Richard Guenther
@ 2008-10-18 23:04                 ` Daniel Berlin
  2008-10-19  4:23                   ` Richard Guenther
  1 sibling, 1 reply; 29+ messages in thread
From: Daniel Berlin @ 2008-10-18 23:04 UTC (permalink / raw)
  To: Richard Guenther
  Cc: Laurent GUERBY, Eric Botcazou, Andreas Schwab, gcc-patches

On Sat, Oct 18, 2008 at 6:27 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Oct 18, 2008 at 4:02 AM, Daniel Berlin <dberlin@dberlin.org> wrote:
>> I'm currently testing the following, which at least doesn't crash on
>> the minimized testcase i produced :)
>
> Looking at that patch I wonder if
>
> -          if (TREE_TYPE (constant) != type)
> +         if (!useless_type_conversion_p (type, TREE_TYPE (constant)))
>
> will also work.

Probably, but we really shouldn't just willy nilly replace one with
the other anyway. :)

If you like, i can try both :)
At worst what is going to happen is that we will call fold_convert a
few more times than necessary, and in very strange cases (where
converting one constant to the other requires a real conversion),
create a small amount of necessary code.

>
> Richard.
>
>>
>> Index: tree-ssa-pre.c
>> ===================================================================
>> --- tree-ssa-pre.c      (revision 141195)
>> +++ tree-ssa-pre.c      (working copy)
>> @@ -3022,21 +3022,13 @@
>>          if (TREE_TYPE (constant) != type)
>>            {
>>              tree builtexpr = fold_convert (type, constant);
>> -             if (is_gimple_min_invariant (builtexpr))
>> +             if (!is_gimple_min_invariant (builtexpr))
>>                {
>> -                 PRE_EXPR_CONSTANT (eprime) = builtexpr;
>> -               }
>> -             else
>> -               {
>>                  tree forcedexpr = force_gimple_operand (builtexpr,
>>                                                          &stmts, true,
>>                                                          NULL);
>> -                 if (is_gimple_min_invariant (forcedexpr))
>> +                 if (!is_gimple_min_invariant (forcedexpr))
>>                    {
>> -                     PRE_EXPR_CONSTANT (eprime) = forcedexpr;
>> -                   }
>> -                 else
>> -                   {
>>                      if (forcedexpr != builtexpr)
>>                        {
>>                          VN_INFO_GET (forcedexpr)->valnum = PRE_EXPR_CONSTANT (eprime);
>>
>>
>> On Fri, Oct 17, 2008 at 2:34 PM, Laurent GUERBY <laurent@guerby.net> wrote:
>>> On Fri, 2008-10-17 at 19:17 +0200, Eric Botcazou wrote:
>>>> > Doesn't break on x86_64-linux-gnu for me (ubuntu hardy), trying
>>>> > i686-pc-linux-gnu.
>>>>
>>>> Really sure?  Our x86 and x86-64 testers are down and Laurent Guerby's tester
>>>> on x86-64 hasn't posted anything to gcc-results@ since rev 141181.
>>>
>>> I confirm 141181 was the last to bootstrap c,ada on x86_64,
>>> the next update of the build script led to a failure:
>>>
>>> Fri Oct 17 04:18:33 CEST 2008
>>> Updating SVN tree
>>> U    gcc/DATESTAMP
>>> U    gcc/ChangeLog
>>> U    gcc/tree-ssa-pre.c
>>> Updated to revision 141186.
>>> ...
>>>
>>> raised STORAGE_ERROR : stack overflow (or erroneous memory access)
>>> gnatmake: "/home/guerby/trunk/gcc/ada/gnatname.adb" compilation error
>>> make[3]: *** [common-tools] Error 4
>>> make[3]: Leaving directory `/home/guerby/build/gcc/ada/tools'
>>> make[2]: *** [gnattools-native] Error 2
>>> make[2]: Leaving directory `/home/guerby/build/gnattools'
>>> make[1]: *** [all-gnattools] Error 2
>>> make[1]: Leaving directory `/home/guerby/build'
>>> make: *** [bootstrap] Error 2
>>> Fri Oct 17 06:22:24 CEST 2008
>>>
>>> For reference, the configure line of my build script is:
>>>
>>> ../trunk/configure --prefix=/n/11/guerby/install-trunk
>>> --enable-languages=c,ada --enable-__cxa_atexit --disable-nls
>>> --enable-threads=posix --with-mpfr=/opt/cfarm/mpfr-2.3.1
>>>
>>> And base version of GCC is "4.1.2 20061115 (prerelease) (Debian
>>> 4.1.1-21)".
>>>
>>> Laurent
>>>
>>>
>>>
>>
>

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-18 23:04                 ` Daniel Berlin
@ 2008-10-19  4:23                   ` Richard Guenther
  2008-10-20 20:23                     ` Daniel Berlin
  0 siblings, 1 reply; 29+ messages in thread
From: Richard Guenther @ 2008-10-19  4:23 UTC (permalink / raw)
  To: Daniel Berlin; +Cc: Laurent GUERBY, Eric Botcazou, Andreas Schwab, gcc-patches

On Sat, Oct 18, 2008 at 7:19 PM, Daniel Berlin <dberlin@dberlin.org> wrote:
> On Sat, Oct 18, 2008 at 6:27 AM, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> On Sat, Oct 18, 2008 at 4:02 AM, Daniel Berlin <dberlin@dberlin.org> wrote:
>>> I'm currently testing the following, which at least doesn't crash on
>>> the minimized testcase i produced :)
>>
>> Looking at that patch I wonder if
>>
>> -          if (TREE_TYPE (constant) != type)
>> +         if (!useless_type_conversion_p (type, TREE_TYPE (constant)))
>>
>> will also work.
>
> Probably, but we really shouldn't just willy nilly replace one with
> the other anyway. :)
>
> If you like, i can try both :)

Yes please ;)

> At worst what is going to happen is that we will call fold_convert a
> few more times than necessary, and in very strange cases (where
> converting one constant to the other requires a real conversion),
> create a small amount of necessary code.

Well, IMHO every time we hit this type-not-compatible case there should
be a bug elsewhere ...

Richard.

>>
>

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-19  4:23                   ` Richard Guenther
@ 2008-10-20 20:23                     ` Daniel Berlin
  2008-10-21 12:36                       ` Laurent GUERBY
  0 siblings, 1 reply; 29+ messages in thread
From: Daniel Berlin @ 2008-10-20 20:23 UTC (permalink / raw)
  To: Richard Guenther
  Cc: Laurent GUERBY, Eric Botcazou, Andreas Schwab, gcc-patches

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

After bootstrapping and regtesting the variant Richard requested, here
is what i am checking in:

2008-10-20  Daniel Berlin  <dberlin@dberlin.org>

        * tree-ssa-pre.c (insert_into_preds_of_block): Don't rewrite constant
        part of expression.

Sorry about the delay


On Sat, Oct 18, 2008 at 1:51 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Oct 18, 2008 at 7:19 PM, Daniel Berlin <dberlin@dberlin.org> wrote:
>> On Sat, Oct 18, 2008 at 6:27 AM, Richard Guenther
>> <richard.guenther@gmail.com> wrote:
>>> On Sat, Oct 18, 2008 at 4:02 AM, Daniel Berlin <dberlin@dberlin.org> wrote:
>>>> I'm currently testing the following, which at least doesn't crash on
>>>> the minimized testcase i produced :)
>>>
>>> Looking at that patch I wonder if
>>>
>>> -          if (TREE_TYPE (constant) != type)
>>> +         if (!useless_type_conversion_p (type, TREE_TYPE (constant)))
>>>
>>> will also work.
>>
>> Probably, but we really shouldn't just willy nilly replace one with
>> the other anyway. :)
>>
>> If you like, i can try both :)
>
> Yes please ;)
>
>> At worst what is going to happen is that we will call fold_convert a
>> few more times than necessary, and in very strange cases (where
>> converting one constant to the other requires a real conversion),
>> create a small amount of necessary code.
>
> Well, IMHO every time we hit this type-not-compatible case there should
> be a bug elsewhere ...
>
> Richard.
>
>>>
>>
>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: prediff.diff --]
[-- Type: text/x-diff; name=prediff.diff, Size: 1003 bytes --]

Index: tree-ssa-pre.c
===================================================================
--- tree-ssa-pre.c	(revision 141195)
+++ tree-ssa-pre.c	(working copy)
@@ -3019,23 +3019,15 @@ insert_into_preds_of_block (basic_block 
 	     should give us back a constant with the right type.
 	  */
 	  tree constant = PRE_EXPR_CONSTANT (eprime);
-	  if (TREE_TYPE (constant) != type)
+	  if (!useless_type_conversion_p (type, TREE_TYPE (constant)))
 	    {
 	      tree builtexpr = fold_convert (type, constant);
-	      if (is_gimple_min_invariant (builtexpr))
-		{
-		  PRE_EXPR_CONSTANT (eprime) = builtexpr;
-		}
-	      else
+	      if (!is_gimple_min_invariant (builtexpr)) 
 		{
 		  tree forcedexpr = force_gimple_operand (builtexpr,
 							  &stmts, true,
 							  NULL);
-		  if (is_gimple_min_invariant (forcedexpr))
-		    {
-		      PRE_EXPR_CONSTANT (eprime) = forcedexpr;
-		    }
-		  else
+		  if (!is_gimple_min_invariant (forcedexpr))
 		    {
 		      if (forcedexpr != builtexpr)
 			{

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-20 20:23                     ` Daniel Berlin
@ 2008-10-21 12:36                       ` Laurent GUERBY
  2008-10-21 13:56                         ` Eric Botcazou
  0 siblings, 1 reply; 29+ messages in thread
From: Laurent GUERBY @ 2008-10-21 12:36 UTC (permalink / raw)
  To: Daniel Berlin
  Cc: Richard Guenther, Eric Botcazou, Andreas Schwab, gcc-patches

On Mon, 2008-10-20 at 15:51 -0400, Daniel Berlin wrote:
> After bootstrapping and regtesting the variant Richard requested, here
> is what i am checking in:
> 
> 2008-10-20  Daniel Berlin  <dberlin@dberlin.org>
> 
>         * tree-ssa-pre.c (insert_into_preds_of_block): Don't rewrite constant
>         part of expression.
> 
> Sorry about the delay

Ada bootstrap is back and testsuite is 100% OK, thanks!

http://gcc.gnu.org/ml/gcc-testresults/2008-10/msg01441.html

Laurent


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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-21 12:36                       ` Laurent GUERBY
@ 2008-10-21 13:56                         ` Eric Botcazou
  2008-10-21 14:08                           ` Laurent GUERBY
  0 siblings, 1 reply; 29+ messages in thread
From: Eric Botcazou @ 2008-10-21 13:56 UTC (permalink / raw)
  To: Laurent GUERBY
  Cc: Daniel Berlin, Richard Guenther, Andreas Schwab, gcc-patches

> Ada bootstrap is back and testsuite is 100% OK, thanks!
>
> http://gcc.gnu.org/ml/gcc-testresults/2008-10/msg01441.html

Confirmed on x86 as well.

Btw, do you know why you sometimes have a few ACATS failures in your report?

-- 
Eric Botcazou

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-21 13:56                         ` Eric Botcazou
@ 2008-10-21 14:08                           ` Laurent GUERBY
  2008-10-21 14:23                             ` Andreas Schwab
  0 siblings, 1 reply; 29+ messages in thread
From: Laurent GUERBY @ 2008-10-21 14:08 UTC (permalink / raw)
  To: Eric Botcazou
  Cc: Daniel Berlin, Richard Guenther, Andreas Schwab, gcc-patches

On Tue, 2008-10-21 at 15:12 +0200, Eric Botcazou wrote:
> Btw, do you know why you sometimes have a few ACATS failures in your report?

Most of the time in the logs for these random fail I have a successful
gnatmake then when executing the test the executable file is not found.

This happens less now that we have a sync
in /gcc/testsuite/ada/acats/run_all.sh:

      if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
         sync
      fi
      target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
      cd $dir/tests/$chapter/$i

But this still happens.

Laurent

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-21 14:08                           ` Laurent GUERBY
@ 2008-10-21 14:23                             ` Andreas Schwab
  2008-10-21 14:45                               ` Laurent GUERBY
  0 siblings, 1 reply; 29+ messages in thread
From: Andreas Schwab @ 2008-10-21 14:23 UTC (permalink / raw)
  To: Laurent GUERBY
  Cc: Eric Botcazou, Daniel Berlin, Richard Guenther, gcc-patches

Laurent GUERBY <laurent@guerby.net> writes:

> On Tue, 2008-10-21 at 15:12 +0200, Eric Botcazou wrote:
>> Btw, do you know why you sometimes have a few ACATS failures in your report?
>
> Most of the time in the logs for these random fail I have a successful
> gnatmake then when executing the test the executable file is not found.
>
> This happens less now that we have a sync
> in /gcc/testsuite/ada/acats/run_all.sh:
>
>       if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
>          sync

How can this sync create a file?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-21 14:23                             ` Andreas Schwab
@ 2008-10-21 14:45                               ` Laurent GUERBY
  2008-10-21 15:01                                 ` Andreas Schwab
  0 siblings, 1 reply; 29+ messages in thread
From: Laurent GUERBY @ 2008-10-21 14:45 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Eric Botcazou, Daniel Berlin, Richard Guenther, gcc-patches

On Tue, 2008-10-21 at 15:47 +0200, Andreas Schwab wrote:
> Laurent GUERBY <laurent@guerby.net> writes:
> 
> > On Tue, 2008-10-21 at 15:12 +0200, Eric Botcazou wrote:
> >> Btw, do you know why you sometimes have a few ACATS failures in your report?
> >
> > Most of the time in the logs for these random fail I have a successful
> > gnatmake then when executing the test the executable file is not found.
> >
> > This happens less now that we have a sync
> > in /gcc/testsuite/ada/acats/run_all.sh:
> >
> >       if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
> >          sync
> 
> How can this sync create a file?

The sync is there (in theory) just to help with gnatmake being
successfull but the executable file not being there yet:

      target_gnatmake $extraflags -I$dir/support $main >> $dir/acats.log 2>&1
      if [ $? -ne 0 ]; then
         display "FAIL:	$i"
         failed="${failed}${i} "
         clean_dir
         continue
      fi

      echo "RUN $binmain" >> $dir/acats.log
      cd $dir/run
...

Laurent

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-21 14:45                               ` Laurent GUERBY
@ 2008-10-21 15:01                                 ` Andreas Schwab
  2008-10-22 13:57                                   ` Laurent GUERBY
  0 siblings, 1 reply; 29+ messages in thread
From: Andreas Schwab @ 2008-10-21 15:01 UTC (permalink / raw)
  To: Laurent GUERBY
  Cc: Eric Botcazou, Daniel Berlin, Richard Guenther, gcc-patches

Laurent GUERBY <laurent@guerby.net> writes:

> On Tue, 2008-10-21 at 15:47 +0200, Andreas Schwab wrote:
>> Laurent GUERBY <laurent@guerby.net> writes:
>> 
>> > On Tue, 2008-10-21 at 15:12 +0200, Eric Botcazou wrote:
>> >> Btw, do you know why you sometimes have a few ACATS failures in your report?
>> >
>> > Most of the time in the logs for these random fail I have a successful
>> > gnatmake then when executing the test the executable file is not found.
>> >
>> > This happens less now that we have a sync
>> > in /gcc/testsuite/ada/acats/run_all.sh:
>> >
>> >       if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
>> >          sync
>> 
>> How can this sync create a file?
>
> The sync is there (in theory) just to help with gnatmake being
> successfull but the executable file not being there yet:

If the file is not there then it has never been created, and a sync
cannot change that.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-21 15:01                                 ` Andreas Schwab
@ 2008-10-22 13:57                                   ` Laurent GUERBY
  2008-10-22 14:04                                     ` Andreas Schwab
  0 siblings, 1 reply; 29+ messages in thread
From: Laurent GUERBY @ 2008-10-22 13:57 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Eric Botcazou, Daniel Berlin, Richard Guenther, gcc-patches

On Tue, 2008-10-21 at 15:55 +0200, Andreas Schwab wrote:
> Laurent GUERBY <laurent@guerby.net> writes:
> 
> > On Tue, 2008-10-21 at 15:47 +0200, Andreas Schwab wrote:
> >> Laurent GUERBY <laurent@guerby.net> writes:
> >> 
> >> > On Tue, 2008-10-21 at 15:12 +0200, Eric Botcazou wrote:
> >> >> Btw, do you know why you sometimes have a few ACATS failures in your report?
> >> >
> >> > Most of the time in the logs for these random fail I have a successful
> >> > gnatmake then when executing the test the executable file is not found.
> >> >
> >> > This happens less now that we have a sync
> >> > in /gcc/testsuite/ada/acats/run_all.sh:
> >> >
> >> >       if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
> >> >          sync
> >> 
> >> How can this sync create a file?
> >
> > The sync is there (in theory) just to help with gnatmake being
> > successfull but the executable file not being there yet:
> 
> If the file is not there then it has never been created, and a sync
> cannot change that.

I started to instrument the run_all.sh script, for the spurious
failures here:

http://gcc.gnu.org/ml/gcc-testresults/2008-10/msg01508.html

LAST_UPDATED: Tue Oct 21 19:42:39 UTC 2008 (revision 141275)

		=== acats tests ===
FAIL:	c48009d
FAIL:	cb20006

The content of the cb2006 test build directory just after the sync were:

total 100
-rw-r--r-- 1 guerby guerby 12035 2008-10-22 01:03 b~cb20006.adb
-rw-r--r-- 1 guerby guerby 18881 2008-10-22 01:03 b~cb20006.ads
-rw-r--r-- 1 guerby guerby  8083 2008-10-22 01:03 b~cb20006.ali
-rw-r--r-- 1 guerby guerby 15680 2008-10-22 01:03 b~cb20006.o
-rw-r--r-- 1 guerby guerby     0 2008-10-22 01:03 cb20006
-rw-r--r-- 1 guerby guerby  2498 2008-10-22 01:03 cb20006_0.adb
-rw-r--r-- 1 guerby guerby  2739 2008-10-22 01:03 cb20006_0.ads
-rw-r--r-- 1 guerby guerby  2384 2008-10-22 01:03 cb20006_0.ali
-rw-r--r-- 1 guerby guerby  8400 2008-10-22 01:03 cb20006_0.o
-rw-r--r-- 1 guerby guerby  2716 2008-10-22 01:03 cb20006.adb
-rw-r--r-- 1 guerby guerby  2381 2008-10-22 01:03 cb20006.ali
-rw-r--r-- 1 guerby guerby    12 2008-10-22 01:03 cb20006.lst
-rw-r--r-- 1 guerby guerby  5784 2008-10-22 01:03 cb20006.o

The "cb20006" file was there but empty and not executable hence the
failure and sync triggering. I don't know why the linker last called by
gnatmake left such a state.

The c47009d test failed spuriously too but did not trigger the sync
and so I've no detailed log.

Still investigating.

Laurent


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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-22 13:57                                   ` Laurent GUERBY
@ 2008-10-22 14:04                                     ` Andreas Schwab
  2008-10-22 14:40                                       ` Laurent GUERBY
  2008-10-25 23:21                                       ` Ada ACATS random FAIL / scripting help wanted (was:Fix missed PRE optimization discovered) Laurent GUERBY
  0 siblings, 2 replies; 29+ messages in thread
From: Andreas Schwab @ 2008-10-22 14:04 UTC (permalink / raw)
  To: Laurent GUERBY
  Cc: Eric Botcazou, Daniel Berlin, Richard Guenther, gcc-patches

Laurent GUERBY <laurent@guerby.net> writes:

> The "cb20006" file was there but empty and not executable hence the
> failure and sync triggering. I don't know why the linker last called by
> gnatmake left such a state.

Perhaps it crashed?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH]: Fix missed PRE optimization discovered
  2008-10-22 14:04                                     ` Andreas Schwab
@ 2008-10-22 14:40                                       ` Laurent GUERBY
  2008-10-25 23:21                                       ` Ada ACATS random FAIL / scripting help wanted (was:Fix missed PRE optimization discovered) Laurent GUERBY
  1 sibling, 0 replies; 29+ messages in thread
From: Laurent GUERBY @ 2008-10-22 14:40 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Eric Botcazou, Daniel Berlin, Richard Guenther, gcc-patches

On Wed, 2008-10-22 at 15:24 +0200, Andreas Schwab wrote:
> Laurent GUERBY <laurent@guerby.net> writes:
> 
> > The "cb20006" file was there but empty and not executable hence the
> > failure and sync triggering. I don't know why the linker last called by
> > gnatmake left such a state.
> 
> Perhaps it crashed?

gnatlink is using gcc/ada/adaint.c:__gnat_portable_spawn (which calls
fork/execv/waitpid and seems correct to me) to call the linker. I assume
if the linker crashed the exit code from gnatlink and thus gnatmake
would have indicated a failure and thus we would not reach the sync code
in run_all.sh.

I saw no "xxx segfault" related to linker in /var/log too.

Any hint on where to look welcomed :).

Laurent

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

* Re: Ada ACATS random FAIL / scripting help wanted (was:Fix missed  PRE optimization discovered)
  2008-10-22 14:04                                     ` Andreas Schwab
  2008-10-22 14:40                                       ` Laurent GUERBY
@ 2008-10-25 23:21                                       ` Laurent GUERBY
  2008-10-26  0:17                                         ` Andreas Schwab
  1 sibling, 1 reply; 29+ messages in thread
From: Laurent GUERBY @ 2008-10-25 23:21 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Eric Botcazou, Daniel Berlin, Richard Guenther, gcc-patches

On Wed, 2008-10-22 at 15:24 +0200, Andreas Schwab wrote:
> Laurent GUERBY <laurent@guerby.net> writes:
> 
> > The "cb20006" file was there but empty and not executable hence the
> > failure and sync triggering. I don't know why the linker last called by
> > gnatmake left such a state.
> 
> Perhaps it crashed?

My tester got one random failure today:

http://gcc.gnu.org/ml/gcc-testresults/2008-10/msg01782.html

In the logs:

/home/guerby/trunk/gcc/testsuite/ada/acats/run_all.sh: line 234: cd: /home/guerby/build/gcc/testsuite/ada/acats/tests/c4/c48011a: No such file or directory
FAIL:   c48011a

line 233 and 234 of my (modified) copy of run_all.sh:

      test=$dir/tests/$chapter/$i
      mkdir $test && cd $test >> $dir/acats.log 2>&1

Is "mkdir X && cd X" known to be an unreliable script sequence?
If so, what commands should used instead? (disk space is not an issue
here, > 200 GB free on the filesystem).

Thanks!

Laurent

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

* Re: Ada ACATS random FAIL / scripting help wanted (was:Fix missed PRE optimization discovered)
  2008-10-25 23:21                                       ` Ada ACATS random FAIL / scripting help wanted (was:Fix missed PRE optimization discovered) Laurent GUERBY
@ 2008-10-26  0:17                                         ` Andreas Schwab
  2008-10-26  0:33                                           ` Laurent GUERBY
  0 siblings, 1 reply; 29+ messages in thread
From: Andreas Schwab @ 2008-10-26  0:17 UTC (permalink / raw)
  To: Laurent GUERBY
  Cc: Eric Botcazou, Daniel Berlin, Richard Guenther, gcc-patches

Laurent GUERBY <laurent@guerby.net> writes:

> Is "mkdir X && cd X" known to be an unreliable script sequence?

If that doesn't work, then either your filesystem is broken, or another
process deleted the directory in between the commands.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: Ada ACATS random FAIL / scripting help wanted (was:Fix missed  PRE optimization discovered)
  2008-10-26  0:17                                         ` Andreas Schwab
@ 2008-10-26  0:33                                           ` Laurent GUERBY
  2008-11-06 13:36                                             ` Laurent GUERBY
  0 siblings, 1 reply; 29+ messages in thread
From: Laurent GUERBY @ 2008-10-26  0:33 UTC (permalink / raw)
  To: Andreas Schwab
  Cc: Eric Botcazou, Daniel Berlin, Richard Guenther, gcc-patches

On Sun, 2008-10-26 at 00:46 +0200, Andreas Schwab wrote:
> Laurent GUERBY <laurent@guerby.net> writes:
> 
> > Is "mkdir X && cd X" known to be an unreliable script sequence?
> 
> If that doesn't work, then either your filesystem is broken, or another
> process deleted the directory in between the commands.

I have only one continuous build script on this system launched with
nohup and looping "while true; do" over invoking configure, make -j 1
bootstrap and then make -j 1 check so no other process and no
"background" tasks.

The OS is debian etch with only standard packages and kernel (2.6.18),
the filesystem is the default ext3, from /proc/mounts:
/dev/sda1 / ext3 rw,data=ordered 0 0
Uptime is 246 days.

The hardware is bi-dual opteron (Dell SC1435) and load is usually
at four or above (by other users of the compile farm).

As far as I remember the "sync" command I added lowered the number
of random fails, but as you noted it shouldn't have any effect.

Laurent

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

* Re: Ada ACATS random FAIL / scripting help wanted (was:Fix missed  PRE optimization discovered)
  2008-10-26  0:33                                           ` Laurent GUERBY
@ 2008-11-06 13:36                                             ` Laurent GUERBY
  2008-11-06 14:03                                               ` Laurent GUERBY
  0 siblings, 1 reply; 29+ messages in thread
From: Laurent GUERBY @ 2008-11-06 13:36 UTC (permalink / raw)
  To: Andreas Schwab, Arnaud Charlet
  Cc: Eric Botcazou, Daniel Berlin, Richard Guenther, gcc-patches

On Sun, 2008-10-26 at 01:01 +0200, Laurent GUERBY wrote:
> On Sun, 2008-10-26 at 00:46 +0200, Andreas Schwab wrote:
> > Laurent GUERBY <laurent@guerby.net> writes:
> > 
> > > Is "mkdir X && cd X" known to be an unreliable script sequence?
> > 
> > If that doesn't work, then either your filesystem is broken, or another
> > process deleted the directory in between the commands.
> 
> I have only one continuous build script on this system launched with
> nohup and looping "while true; do" over invoking configure, make -j 1
> bootstrap and then make -j 1 check so no other process and no
> "background" tasks.
> 
> The OS is debian etch with only standard packages and kernel (2.6.18),
> the filesystem is the default ext3, from /proc/mounts:
> /dev/sda1 / ext3 rw,data=ordered 0 0
> Uptime is 246 days.
> 
> The hardware is bi-dual opteron (Dell SC1435) and load is usually
> at four or above (by other users of the compile farm).
> 
> As far as I remember the "sync" command I added lowered the number
> of random fails, but as you noted it shouldn't have any effect.

I added some logs after gnatmake in run_all.sh:

      ZSTAMP=none
      if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
         sync
         ZSTAMP=$(date '+%Y%m%dT%H%M%S')
         ls -l $dir/tests/$chapter/$i/ > /home/guerby/tmp/acats/postsync-${i}-${ZSTAMP} 2>&1
      fi
      target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
      if [ x$ZSTAMP != "xnone" ]; then
          ls -l $dir/tests/$chapter/$i/ > /home/guerby/tmp/acats/postsync2-${i}-${ZSTAMP} 2>&1
          cp -f $dir/tests/$chapter/$i/${i}.log /home/guerby/tmp/acats/last-${i}-${ZSTAMP}.log
          sleep 1
          ls -l $dir/tests/$chapter/$i/ > /home/guerby/tmp/acats/postsync3-${i}-${ZSTAMP} 2>&1
      fi

It trigered a few days ago:

guerby@gcc13:~/tmp/acats$ cat  postsync-c490001-20081101T131811
total 40
-rw-r--r-- 1 guerby guerby  412 2008-11-01 13:18 c490001_0.adb
-rw-r--r-- 1 guerby guerby 6896 2008-11-01 13:18 c490001_0.ads
-rw-r--r-- 1 guerby guerby 1625 2008-11-01 13:18 c490001_0.ali
-rw-r--r-- 1 guerby guerby 2640 2008-11-01 13:18 c490001_0.o
-rw-r--r-- 1 guerby guerby 1633 2008-11-01 13:18 c490001.adb
-rw-r--r-- 1 guerby guerby 1190 2008-11-01 13:18 c490001.ali
-rw-r--r-- 1 guerby guerby   12 2008-11-01 13:18 c490001.lst
-rw-r--r-- 1 guerby guerby 4192 2008-11-01 13:18 c490001.o
guerby@gcc13:~/tmp/acats$ cat  postsync2-c490001-20081101T131811
total 44
-rw-r--r-- 1 guerby guerby  412 2008-11-01 13:18 c490001_0.adb
-rw-r--r-- 1 guerby guerby 6896 2008-11-01 13:18 c490001_0.ads
-rw-r--r-- 1 guerby guerby 1625 2008-11-01 13:18 c490001_0.ali
-rw-r--r-- 1 guerby guerby 2640 2008-11-01 13:18 c490001_0.o
-rw-r--r-- 1 guerby guerby 1633 2008-11-01 13:18 c490001.adb
-rw-r--r-- 1 guerby guerby 1190 2008-11-01 13:18 c490001.ali
-rw-r--r-- 1 guerby guerby  159 2008-11-01 13:18 c490001.log
-rw-r--r-- 1 guerby guerby   12 2008-11-01 13:18 c490001.lst
-rw-r--r-- 1 guerby guerby 4192 2008-11-01 13:18 c490001.o
guerby@gcc13:~/tmp/acats$ cat last-c490001-20081101T131811.log
/home/guerby/trunk/gcc/testsuite/ada/acats/run_all.sh: line 16: /home/guerby/build/gcc/testsuite/ada/acats/tests/c4/c490001/c490001: No such file or directory
guerby@gcc13:~/tmp/acats$ cat postsync3-c490001-20081101T131811
total 1192
-rwxr-xr-x 1 guerby guerby 1170175 2008-11-01 13:18 c490001
-rw-r--r-- 1 guerby guerby     412 2008-11-01 13:18 c490001_0.adb
-rw-r--r-- 1 guerby guerby    6896 2008-11-01 13:18 c490001_0.ads
-rw-r--r-- 1 guerby guerby    1625 2008-11-01 13:18 c490001_0.ali
-rw-r--r-- 1 guerby guerby    2640 2008-11-01 13:18 c490001_0.o
-rw-r--r-- 1 guerby guerby    1633 2008-11-01 13:18 c490001.adb
-rw-r--r-- 1 guerby guerby    1190 2008-11-01 13:18 c490001.ali
-rw-r--r-- 1 guerby guerby     159 2008-11-01 13:18 c490001.log
-rw-r--r-- 1 guerby guerby      12 2008-11-01 13:18 c490001.lst
-rw-r--r-- 1 guerby guerby    4192 2008-11-01 13:18 c490001.o

As seen, after "sleep 1" the c490001 executable file appears at last
through "ls" so we now know gnatmake and ld didn't fail and produced
an executable but it appeared with an unexplainable delay.

I've observed this exact same behaviour two times in my logs.

I will propose a patch with a "sleep 1" after the "sync" unless
someone has another idea?

Thanks in advance,

Laurent


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

* Re: Ada ACATS random FAIL / scripting help wanted (was:Fix missed  PRE optimization discovered)
  2008-11-06 13:36                                             ` Laurent GUERBY
@ 2008-11-06 14:03                                               ` Laurent GUERBY
  0 siblings, 0 replies; 29+ messages in thread
From: Laurent GUERBY @ 2008-11-06 14:03 UTC (permalink / raw)
  To: Andreas Schwab, Arnaud Charlet
  Cc: Eric Botcazou, Daniel Berlin, Richard Guenther, gcc-patches

On Sun, 2008-10-26 at 01:01 +0200, Laurent GUERBY wrote:
> On Sun, 2008-10-26 at 00:46 +0200, Andreas Schwab wrote:
> > Laurent GUERBY <laurent@guerby.net> writes:
> > 
> > > Is "mkdir X && cd X" known to be an unreliable script sequence?
> > 
> > If that doesn't work, then either your filesystem is broken, or another
> > process deleted the directory in between the commands.
> 
> I have only one continuous build script on this system launched with
> nohup and looping "while true; do" over invoking configure, make -j 1
> bootstrap and then make -j 1 check so no other process and no
> "background" tasks.
> 
> The OS is debian etch with only standard packages and kernel (2.6.18),
> the filesystem is the default ext3, from /proc/mounts:
> /dev/sda1 / ext3 rw,data=ordered 0 0
> Uptime is 246 days.
> 
> The hardware is bi-dual opteron (Dell SC1435) and load is usually
> at four or above (by other users of the compile farm).
> 
> As far as I remember the "sync" command I added lowered the number
> of random fails, but as you noted it shouldn't have any effect.

I added some logs after gnatmake in run_all.sh:

      ZSTAMP=none
      if [ ! -x $dir/tests/$chapter/$i/$binmain ]; then
         sync
         ZSTAMP=$(date '+%Y%m%dT%H%M%S')
         ls -l $dir/tests/$chapter/$i/ > /home/guerby/tmp/acats/postsync-${i}-${ZSTAMP} 2>&1
      fi
      target_run $dir/tests/$chapter/$i/$binmain > $dir/tests/$chapter/$i/${i}.log 2>&1
      if [ x$ZSTAMP != "xnone" ]; then
          ls -l $dir/tests/$chapter/$i/ > /home/guerby/tmp/acats/postsync2-${i}-${ZSTAMP} 2>&1
          cp -f $dir/tests/$chapter/$i/${i}.log /home/guerby/tmp/acats/last-${i}-${ZSTAMP}.log
          sleep 1
          ls -l $dir/tests/$chapter/$i/ > /home/guerby/tmp/acats/postsync3-${i}-${ZSTAMP} 2>&1
      fi

It trigered a few days ago:

guerby@gcc13:~/tmp/acats$ cat  postsync-c490001-20081101T131811
total 40
-rw-r--r-- 1 guerby guerby  412 2008-11-01 13:18 c490001_0.adb
-rw-r--r-- 1 guerby guerby 6896 2008-11-01 13:18 c490001_0.ads
-rw-r--r-- 1 guerby guerby 1625 2008-11-01 13:18 c490001_0.ali
-rw-r--r-- 1 guerby guerby 2640 2008-11-01 13:18 c490001_0.o
-rw-r--r-- 1 guerby guerby 1633 2008-11-01 13:18 c490001.adb
-rw-r--r-- 1 guerby guerby 1190 2008-11-01 13:18 c490001.ali
-rw-r--r-- 1 guerby guerby   12 2008-11-01 13:18 c490001.lst
-rw-r--r-- 1 guerby guerby 4192 2008-11-01 13:18 c490001.o
guerby@gcc13:~/tmp/acats$ cat  postsync2-c490001-20081101T131811
total 44
-rw-r--r-- 1 guerby guerby  412 2008-11-01 13:18 c490001_0.adb
-rw-r--r-- 1 guerby guerby 6896 2008-11-01 13:18 c490001_0.ads
-rw-r--r-- 1 guerby guerby 1625 2008-11-01 13:18 c490001_0.ali
-rw-r--r-- 1 guerby guerby 2640 2008-11-01 13:18 c490001_0.o
-rw-r--r-- 1 guerby guerby 1633 2008-11-01 13:18 c490001.adb
-rw-r--r-- 1 guerby guerby 1190 2008-11-01 13:18 c490001.ali
-rw-r--r-- 1 guerby guerby  159 2008-11-01 13:18 c490001.log
-rw-r--r-- 1 guerby guerby   12 2008-11-01 13:18 c490001.lst
-rw-r--r-- 1 guerby guerby 4192 2008-11-01 13:18 c490001.o
guerby@gcc13:~/tmp/acats$ cat last-c490001-20081101T131811.log
/home/guerby/trunk/gcc/testsuite/ada/acats/run_all.sh: line 16: /home/guerby/build/gcc/testsuite/ada/acats/tests/c4/c490001/c490001: No such file or directory
guerby@gcc13:~/tmp/acats$ cat postsync3-c490001-20081101T131811
total 1192
-rwxr-xr-x 1 guerby guerby 1170175 2008-11-01 13:18 c490001
-rw-r--r-- 1 guerby guerby     412 2008-11-01 13:18 c490001_0.adb
-rw-r--r-- 1 guerby guerby    6896 2008-11-01 13:18 c490001_0.ads
-rw-r--r-- 1 guerby guerby    1625 2008-11-01 13:18 c490001_0.ali
-rw-r--r-- 1 guerby guerby    2640 2008-11-01 13:18 c490001_0.o
-rw-r--r-- 1 guerby guerby    1633 2008-11-01 13:18 c490001.adb
-rw-r--r-- 1 guerby guerby    1190 2008-11-01 13:18 c490001.ali
-rw-r--r-- 1 guerby guerby     159 2008-11-01 13:18 c490001.log
-rw-r--r-- 1 guerby guerby      12 2008-11-01 13:18 c490001.lst
-rw-r--r-- 1 guerby guerby    4192 2008-11-01 13:18 c490001.o

As seen, after "sleep 1" the c490001 executable file appears at last
through "ls" so we now know gnatmake and ld didn't fail and produced
an executable but it appeared with an unexplainable delay.

I've observed this exact same behaviour two times in my logs.

I will propose a patch with a "sleep 1" after the "sync" unless
someone has another idea?

Thanks in advance,

Laurent


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

end of thread, other threads:[~2008-11-06 13:36 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-16 23:29 [PATCH]: Fix missed PRE optimization discovered Daniel Berlin
2008-10-17 13:05 ` Andreas Schwab
2008-10-17 13:08   ` Eric Botcazou
2008-10-17 15:41     ` Daniel Berlin
2008-10-17 17:08       ` Daniel Berlin
2008-10-17 17:56         ` Daniel Berlin
2008-10-17 19:08         ` Eric Botcazou
2008-10-17 22:24           ` Daniel Berlin
2008-10-17 22:46           ` Laurent GUERBY
2008-10-18 10:28             ` Daniel Berlin
2008-10-18 18:03               ` Richard Guenther
2008-10-18 18:05                 ` Richard Guenther
2008-10-18 23:04                 ` Daniel Berlin
2008-10-19  4:23                   ` Richard Guenther
2008-10-20 20:23                     ` Daniel Berlin
2008-10-21 12:36                       ` Laurent GUERBY
2008-10-21 13:56                         ` Eric Botcazou
2008-10-21 14:08                           ` Laurent GUERBY
2008-10-21 14:23                             ` Andreas Schwab
2008-10-21 14:45                               ` Laurent GUERBY
2008-10-21 15:01                                 ` Andreas Schwab
2008-10-22 13:57                                   ` Laurent GUERBY
2008-10-22 14:04                                     ` Andreas Schwab
2008-10-22 14:40                                       ` Laurent GUERBY
2008-10-25 23:21                                       ` Ada ACATS random FAIL / scripting help wanted (was:Fix missed PRE optimization discovered) Laurent GUERBY
2008-10-26  0:17                                         ` Andreas Schwab
2008-10-26  0:33                                           ` Laurent GUERBY
2008-11-06 13:36                                             ` Laurent GUERBY
2008-11-06 14:03                                               ` Laurent GUERBY

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