Bug 20623 - ICE: fold check: original tree changed by fold with --enable-checking=fold
Summary: ICE: fold check: original tree changed by fold with --enable-checking=fold
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-checking, ice-on-valid-code
Depends on: 16045 20931 22455
Blocks:
  Show dependency treegraph
 
Reported: 2005-03-24 15:07 UTC by Michael Cieslinski
Modified: 2010-02-27 14:06 UTC (History)
7 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: x86_64-unknown-linux-gnu
Build: x86_64-unknown-linux-gnu
Known to work: 4.3.0
Known to fail: 4.0.4 4.1.2 4.1.3 4.2.2 4.2.3
Last reconfirmed: 2008-01-26 05:11:37


Attachments
759_pr20623.diff (1.11 KB, patch)
2007-06-20 23:31 UTC, Sebastian Pop
Details | Diff
764_pr20623.diff (1.98 KB, text/x-diff)
2007-06-21 18:21 UTC, Sebastian Pop
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Cieslinski 2005-03-24 15:07:32 UTC
I built gcc from the actual snapshot (gcc-4.1-20050320) with --enable-
checking=fold and run make check.

I got ICEs "fold check: original tree changed by fold" on 28 different files

g++.dg/inherit/ptrmem2.C:23: internal compiler error: fold check: original tree 
changed by fold
g++.dg/parse/defarg5.C:14: internal compiler error: fold check: original tree 
changed by fold
g++.dg/template/ctor1.C:16: internal compiler error: fold check: original tree 
changed by fold
g++.old-deja/g++.ext/anon3.C:26: internal compiler error: fold check: original 
tree changed by fold
g++.old-deja/g++.jason/bool4.C:10: internal compiler error: fold check: 
original tree changed by fold
g++.old-deja/g++.mike/bool2.C:47: internal compiler error: fold check: original 
tree changed by fold
g++.old-deja/g++.mike/pmf8.C:27: internal compiler error: fold check: original 
tree changed by fold
gcc.c-torture/compile/20020701-1.c:33: internal compiler error: fold check: 
original tree changed by fold
gcc.c-torture/execute/builtins/memmove-2.c:23: internal compiler error: fold 
check: original tree changed by fold
gcc.c-torture/execute/builtins/strcat.c:26: internal compiler error: fold 
check: original tree changed by fold
gcc.c-torture/execute/builtins/strncat.c:23: internal compiler error: fold 
check: original tree changed by fold
gcc.c-torture/execute/builtins/strncpy.c:43: internal compiler error: fold 
check: original tree changed by fold
gcc.c-torture/execute/builtins/strstr-asm.c:22: internal compiler error: fold 
check: original tree changed by fold
gcc.c-torture/execute/builtins/strstr-asm.c:36: internal compiler error: fold 
check: original tree changed by fold
gcc.c-torture/execute/builtins/strstr.c:16: internal compiler error: fold 
check: original tree changed by fold
gcc.c-torture/execute/memcpy-bi.c:30: internal compiler error: fold check: 
original tree changed by fold
gcc.c-torture/execute/string-opt-18.c:39: internal compiler error: fold check: 
original tree changed by fold
gcc.dg/builtins-10.c:27: internal compiler error: fold check: original tree 
changed by fold
gcc.dg/builtins-2.c:35: internal compiler error: fold check: original tree 
changed by fold
gcc.dg/builtins-21.c:28: internal compiler error: fold check: original tree 
changed by fold
gcc.dg/builtins-26.c:27: internal compiler error: fold check: original tree 
changed by fold
gcc.dg/builtins-47.c:11: internal compiler error: fold check: original tree 
changed by fold
gcc.dg/builtins-52.c:12: internal compiler error: fold check: original tree 
changed by fold
gcc.dg/builtins-7.c:25: internal compiler error: fold check: original tree 
changed by fold
gcc.dg/pr19402-1.c:8: internal compiler error: fold check: original tree 
changed by fold
gcc.dg/torture/builtin-explog-1.c:66: internal compiler error: fold check: 
original tree changed by fold
gcc.dg/torture/builtin-integral-1.c:53: internal compiler error: fold check: 
original tree changed by fold
gcc.dg/unordered-1.c:7: internal compiler error: fold check: original tree 
changed by fold

All the ICEs above do not occur when I do not specify --enable-checking=fold.

Michael Cieslinski
Comment 1 Andrew Pinski 2005-03-24 15:11:53 UTC
Most if not all of the problems are listed in PR 16045.  Well all of the builtins related failures are listed 
there.
Comment 2 Andrew Pinski 2005-04-16 16:38:48 UTC
The C++ failures are most likely PR 20931.
Comment 3 Andrew Pinski 2005-07-04 21:16:45 UTC
How many still fail today?
Comment 4 Michael Cieslinski 2005-07-05 10:48:56 UTC
With snapshot gcc-4.1-20050702 the following gcc tests fail:

gcc.c-torture/compile/20020701-1.c
gcc.c-torture/compile/20021108-1.c
gcc.c-torture/compile/920501-7.c
gcc.c-torture/compile/labels-1.c
gcc.c-torture/compile/labels-2.c
gcc.c-torture/compile/labels-3.c
gcc.c-torture/execute/builtins/memmove-2.c
gcc.c-torture/execute/builtins/strcat-chk.c
gcc.c-torture/execute/builtins/strcat.c
gcc.c-torture/execute/builtins/strncat-chk.c
gcc.c-torture/execute/builtins/strncat.c
gcc.c-torture/execute/builtins/strncpy-chk.c
gcc.c-torture/execute/builtins/strncpy.c
gcc.c-torture/execute/builtins/strstr-asm.c
gcc.c-torture/execute/builtins/strstr.c
gcc.c-torture/execute/memcpy-bi.c
gcc.c-torture/execute/string-opt-18.c
gcc.dg/20021029-1.c
gcc.dg/builtins-10.c
gcc.dg/builtins-2.c
gcc.dg/builtins-21.c
gcc.dg/builtins-26.c
gcc.dg/builtins-47.c
gcc.dg/builtins-52.c
gcc.dg/builtins-7.c
gcc.dg/pr16973.c
gcc.dg/pr19402-1.c
gcc.dg/torture/builtin-explog-1.c
gcc.dg/torture/builtin-integral-1.c


All with a message like:
gcc-4.1-20050702/gcc/testsuite/gcc.c-torture/compile/20020701-1.c:33: internal 
compiler error: fold check: original tree changed by fold


Michael Cieslinski
Comment 5 Andrew Pinski 2005-08-18 05:03:08 UTC
This depends on PR 22455 now as --enable-checking=fold is broken.
Comment 6 Andrew Pinski 2005-10-25 19:19:59 UTC
Can you try this again, I think these are all fixed now?
Comment 7 Michael Cieslinski 2005-10-26 14:17:27 UTC
With the snapshot gcc-4.1-20051022 I get the following additional errors when I use --enable-checking=fold and run make check

gcc.c-torture/compile/20021108-1.c
gcc.c-torture/compile/920501-7.c
gcc.c-torture/compile/labels-1.c
gcc.c-torture/compile/labels-2.c
gcc.c-torture/compile/labels-3.c
gcc.dg/20021029-1.c
gcc.dg/pr16973.c

all fail with the message:
"internal compiler error: fold check: original tree changed by fold"

Michael
Comment 8 Andrew Pinski 2005-10-26 16:54:58 UTC
(In reply to comment #7)
> With the snapshot gcc-4.1-20051022 I get the following additional errors when I
> use --enable-checking=fold and run make check

Thanks, that is only one bug now as they all have the following in common, they use address of label extension.
Comment 9 Kaveh Ghazi 2006-02-16 02:51:15 UTC
Still have the address of labels failure on 4.0, 4.1 and mainline:
http://gcc.gnu.org/ml/gcc-testresults/2006-02/msg00383.html
http://gcc.gnu.org/ml/gcc-testresults/2006-02/msg00431.html
http://gcc.gnu.org/ml/gcc-testresults/2006-02/msg00508.html

4.0 has some additional errors that I believe can be fixed by backporting the fix for PR16045.
Comment 10 Kaveh Ghazi 2006-02-21 13:59:15 UTC
4.0 results are now on par with 4.1, meaning AFAICS we only have the address of labels problem to worry about on all 4.* branches.
http://gcc.gnu.org/ml/gcc-testresults/2006-02/msg00986.html
Comment 11 Ryan S. Arnold 2006-06-02 20:11:56 UTC
I recently ran into this on ppc/ppc64 when building a toolchain with gcc4.1 or gcc4.2.

When the bootstrap gcc was built with --enable-checking=all (or =fold which we just tested) the glibc 32bit build stage fails in vfprintf.  Peter Bergner extracted the minimal failure bit out here:

vfprintf.c
int main (void)
{
  static void *array[] = { &&foo - &&bar };
  return 0;
foo:
  return 1;
bar:
  return 2;
} 
Compiler /home/user/gcc/gcc-4_1-20060601-2-biarch/bin/gcc compiled with --enable-checking=all (=fold)

user@host:~/gcc/bugs/vfprintf> /home/user/gcc/gcc-4_1-20060601-2-biarch/bin/gcc -c vfprintf.c
vfprintf.c: In function main:
vfprintf.c:3: internal compiler error: fold check: original tree changed by fold
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 12 Kaveh Ghazi 2007-01-16 04:52:08 UTC
Same results one year later on sparc/sparc64 solaris2.10 with 4.0.x branch using --enable-checking=yes,rtl,fold:
http://gcc.gnu.org/ml/gcc-testresults/2007-01/msg00592.html
http://gcc.gnu.org/ml/gcc-testresults/2007-01/msg00593.html

will check other branches, but it takes a while...
Comment 13 Kaveh Ghazi 2007-01-18 14:42:45 UTC
4.1.x branch still has the fold checking errors with labels:
http://gcc.gnu.org/ml/gcc-testresults/2007-01/msg00699.html
http://gcc.gnu.org/ml/gcc-testresults/2007-01/msg00700.html
Comment 14 Richard Biener 2007-06-20 12:28:08 UTC
*** Bug 32024 has been marked as a duplicate of this bug. ***
Comment 15 Sebastian Pop 2007-06-20 18:50:24 UTC
(In reply to comment #5)
> This depends on PR 22455 now as --enable-checking=fold is broken.
> 

With 
Comment 16 Rob 2007-06-20 22:46:30 UTC
Uros Bizjak seems to have tracked this problems down for 4.3.0 on target i686-pc-cygwin and i686-pc-linux-gnu in the bug report that Richard just marked as a dupe.
Comment 17 Sebastian Pop 2007-06-20 22:58:02 UTC
Subject: Re:  ICE: fold check: original tree changed by fold with --enable-checking=fold

Hi,

The following patch fixes a part of the reported testsuite fails.
With this patch we avoid folding the TREE_CHAIN of an SSA_NAME, that
corresponds to its SSA_NAME_DEF_STMT.

Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c	(revision 125883)
+++ gcc/fold-const.c	(working copy)
@@ -12775,7 +12775,8 @@ recursive_label:
   fold_checksum_tree (TREE_TYPE (expr), ctx, ht);
   if (TREE_CODE_CLASS (code) != tcc_type
       && TREE_CODE_CLASS (code) != tcc_declaration
-      && code != TREE_LIST)
+      && code != TREE_LIST
+      && code != SSA_NAME)
     fold_checksum_tree (TREE_CHAIN (expr), ctx, ht);
   switch (TREE_CODE_CLASS (code))
     {

The only fails that remain when compiling with default languages and
--enable-checking=assert,fold,gc,misc,rtl,rtlflag,runtime,tree
on i686-linux are:

gcc.c-torture/compile/20021108-1.c
gcc.c-torture/compile/920501-7.c
gcc.c-torture/compile/labels-1.c
gcc.c-torture/compile/labels-2.c
gcc.c-torture/compile/labels-3.c
gcc.c-torture/execute/comp-goto-1.c
gcc.dg/20021029-1.c
gcc.dg/pr16973.c

Okay for trunk?

Sebastian

PS: The remaining tests all fail when fold_build2 is passed an
ADDR_EXPR with a MINUS_EXPR.
Comment 18 Sebastian Pop 2007-06-20 23:31:59 UTC
Subject: Re:  ICE: fold check: original tree changed by fold with --enable-checking=fold

Hi, here is the final fix for the remaining cases, closing this PR.
Okay for trunk after bootntest on i686-linux with default languages
and --enable-checking=assert,fold,gc,misc,rtl,rtlflag,runtime,tree ?

Sebastian
Comment 19 Sebastian Pop 2007-06-20 23:31:59 UTC
Created attachment 13752 [details]
759_pr20623.diff
Comment 20 rguenther@suse.de 2007-06-21 07:59:50 UTC
Subject: Re:  ICE: fold check: original tree changed
 by fold with --enable-checking=fold

On Thu, 20 Jun 2007, spop at gcc dot gnu dot org wrote:

> 
> 
> ------- Comment #17 from spop at gcc dot gnu dot org  2007-06-20 22:58 -------
> Subject: Re:  ICE: fold check: original tree changed by fold with
> --enable-checking=fold
> 
> Hi,
> 
> The following patch fixes a part of the reported testsuite fails.
> With this patch we avoid folding the TREE_CHAIN of an SSA_NAME, that
> corresponds to its SSA_NAME_DEF_STMT.
> 
> Index: gcc/fold-const.c
> ===================================================================
> --- gcc/fold-const.c    (revision 125883)
> +++ gcc/fold-const.c    (working copy)
> @@ -12775,7 +12775,8 @@ recursive_label:
>    fold_checksum_tree (TREE_TYPE (expr), ctx, ht);
>    if (TREE_CODE_CLASS (code) != tcc_type
>        && TREE_CODE_CLASS (code) != tcc_declaration
> -      && code != TREE_LIST)
> +      && code != TREE_LIST
> +      && code != SSA_NAME)
>      fold_checksum_tree (TREE_CHAIN (expr), ctx, ht);
>    switch (TREE_CODE_CLASS (code))
>      {
> 
> The only fails that remain when compiling with default languages and
> --enable-checking=assert,fold,gc,misc,rtl,rtlflag,runtime,tree
> on i686-linux are:
> 
> gcc.c-torture/compile/20021108-1.c
> gcc.c-torture/compile/920501-7.c
> gcc.c-torture/compile/labels-1.c
> gcc.c-torture/compile/labels-2.c
> gcc.c-torture/compile/labels-3.c
> gcc.c-torture/execute/comp-goto-1.c
> gcc.dg/20021029-1.c
> gcc.dg/pr16973.c
> 
> Okay for trunk?

Yes, this is ok.

Richard.
Comment 21 rguenther@suse.de 2007-06-21 08:01:53 UTC
Subject: Re:  ICE: fold check: original tree changed
 by fold with --enable-checking=fold

On Thu, 20 Jun 2007, spop at gcc dot gnu dot org wrote:

> 
> 
> ------- Comment #18 from spop at gcc dot gnu dot org  2007-06-20 23:31 -------
> Subject: Re:  ICE: fold check: original tree changed by fold with
> --enable-checking=fold
> 
> Hi, here is the final fix for the remaining cases, closing this PR.
> Okay for trunk after bootntest on i686-linux with default languages
> and --enable-checking=assert,fold,gc,misc,rtl,rtlflag,runtime,tree ?

This doesn't look right - let me investigate.

Richard.
Comment 22 richard.guenther@gmail.com 2007-06-21 08:16:21 UTC
Subject: Re:  ICE: fold check: original tree changed by fold with --enable-checking=fold

On 6/21/07, Sebastian Pop <spop@gcc.gnu.org> wrote:
> Hi, here is the final fix for the remaining cases, closing this PR.
> Okay for trunk after bootntest on i686-linux with default languages
> and --enable-checking=assert,fold,gc,misc,rtl,rtlflag,runtime,tree ?

The fold_binary change looks unnecessary.  The rest is ok.

Thanks,
Richard.
Comment 23 Sebastian Pop 2007-06-21 08:21:40 UTC
Subject: Re:  ICE: fold check: original tree changed by fold with --enable-checking=fold

On 6/21/07, Richard Guenther <richard.guenther@gmail.com> wrote:
>
> The fold_binary change looks unnecessary.

ok.

> The rest is ok.
>

There was something wrong in the rest, so I'm proposing this fix instead,
as we were not using the modified base anymore for building the result 't'.

@@ -14191,14 +14220,15 @@ build_fold_addr_expr_with_type (tree t,
     }
   else
     {
-      tree base = t;
+      tree copy_t = copy_node (t);
+      tree base = copy_t;

       while (handled_component_p (base))
 	base = TREE_OPERAND (base, 0);
       if (DECL_P (base))
 	TREE_ADDRESSABLE (base) = 1;

-      t = build1 (ADDR_EXPR, ptrtype, t);
+      t = build1 (ADDR_EXPR, ptrtype, copy_t);
     }

   return t;
Comment 24 rguenther@suse.de 2007-06-21 08:48:34 UTC
Subject: Re:  ICE: fold check: original tree changed
 by fold with --enable-checking=fold

On Thu, 21 Jun 2007, spop at gcc dot gnu dot org wrote:

> 
> 
> ------- Comment #23 from spop at gcc dot gnu dot org  2007-06-21 08:21 -------
> Subject: Re:  ICE: fold check: original tree changed by fold with
> --enable-checking=fold
> 
> On 6/21/07, Richard Guenther <richard.guenther@gmail.com> wrote:
> >
> > The fold_binary change looks unnecessary.
> 
> ok.
> 
> > The rest is ok.
> >
> 
> There was something wrong in the rest, so I'm proposing this fix instead,
> as we were not using the modified base anymore for building the result 't'.
> 
> @@ -14191,14 +14220,15 @@ build_fold_addr_expr_with_type (tree t,
>      }
>    else
>      {
> -      tree base = t;
> +      tree copy_t = copy_node (t);
> +      tree base = copy_t;
> 
>        while (handled_component_p (base))
>         base = TREE_OPERAND (base, 0);
>        if (DECL_P (base))
>         TREE_ADDRESSABLE (base) = 1;
> 
> -      t = build1 (ADDR_EXPR, ptrtype, t);
> +      t = build1 (ADDR_EXPR, ptrtype, copy_t);
>      }
> 
>    return t;

Oh, indeed.  The above is ok.  (The fold_binary change still looks
unnecessary)

Richard.
Comment 25 richard.guenther@gmail.com 2007-06-21 10:07:25 UTC
Subject: Re:  ICE: fold check: original tree changed by fold with --enable-checking=fold

On 6/21/07, Sebastian Pop <spop@gcc.gnu.org> wrote
> On 6/21/07, Richard Guenther <richard.guenther@gmail.com> wrote:
> >
> > The fold_binary change looks unnecessary.
>
> ok.
>
> > The rest is ok.
> >
>
> There was something wrong in the rest, so I'm proposing this fix instead,
> as we were not using the modified base anymore for building the result 't'.
>
> @@ -14191,14 +14220,15 @@ build_fold_addr_expr_with_type (tree t,
>      }
>    else
>      {
> -      tree base = t;
> +      tree copy_t = copy_node (t);
> +      tree base = copy_t;
>
>        while (handled_component_p (base))
>         base = TREE_OPERAND (base, 0);
>        if (DECL_P (base))
>         TREE_ADDRESSABLE (base) = 1;
>
> -      t = build1 (ADDR_EXPR, ptrtype, t);
> +      t = build1 (ADDR_EXPR, ptrtype, copy_t);
>      }

As you noted copying trees here is wrong, too.  We can either try to get rid
of setting the TREE_ADDRESSABLE flag here or fix fold checking code to
ignore this particular change.  Note the above code is this way since the
tree-ssa merge.

Another thing would be to note where we call this helper from fold() routines
and not set the flag only for those callers which should be safe.  We'd need
another flag argument to the function or another wrapper.

Richard.
Comment 26 Sebastian Pop 2007-06-21 18:21:04 UTC
Subject: Re:  ICE: fold check: original tree changed by fold with --enable-checking=fold

Just to sum it up, and for asking for advice,
attached is the patch that I'm bootstrapping and testing now.

> Another thing would be to note where we call this helper from fold() routines
> and not set the flag only for those callers which should be safe.  We'd need
> another flag argument to the function or another wrapper.
>

In another version of this patch, I replaced all the callers from the
folder, to use a gcc_assert (TREE_ADDRESSABLE (base) == 1), and this
failed because some calls from the C front-end used that function and
did not have set their addressable flag (yet?).  This resulted in all
the fails left in the second part of the bug.

With the attached patch, fold functions do not set that flag, and this
solves the remaining fails.  I'm bootstrapping and testing all
languages again with fold checking.

Sebastian
Comment 27 Sebastian Pop 2007-06-21 18:21:04 UTC
Created attachment 13760 [details]
764_pr20623.diff
Comment 28 rguenther@suse.de 2007-06-21 19:33:26 UTC
Subject: Re:  ICE: fold check: original tree changed
 by fold with --enable-checking=fold

On Thu, 21 Jun 2007, spop at gcc dot gnu dot org wrote:

> ------- Comment #26 from spop at gcc dot gnu dot org  2007-06-21 18:21 -------
> Subject: Re:  ICE: fold check: original tree changed by fold with
> --enable-checking=fold
> 
> Just to sum it up, and for asking for advice,
> attached is the patch that I'm bootstrapping and testing now.
> 
> > Another thing would be to note where we call this helper from fold() routines
> > and not set the flag only for those callers which should be safe.  We'd need
> > another flag argument to the function or another wrapper.
> >
> 
> In another version of this patch, I replaced all the callers from the
> folder, to use a gcc_assert (TREE_ADDRESSABLE (base) == 1), and this
> failed because some calls from the C front-end used that function and
> did not have set their addressable flag (yet?).  This resulted in all
> the fails left in the second part of the bug.
> 
> With the attached patch, fold functions do not set that flag, and this
> solves the remaining fails.  I'm bootstrapping and testing all
> languages again with fold checking.

This looks good (again ;)).

Thanks,
Richard.
Comment 29 Sebastian Pop 2007-06-21 20:55:49 UTC
Subject: Re:  ICE: fold check: original tree changed by fold with --enable-checking=fold

So,
the last patch bootstrapped, and tests passed with exactly the same fails
as on trunk.  I'm going to commit that patch to trunk.  I'll also send a
message with the patch to the gcc-patches@.

Sebastian
Comment 30 Sebastian Pop 2007-06-21 21:25:39 UTC
Subject: Bug 20623

Author: spop
Date: Thu Jun 21 21:25:27 2007
New Revision: 125929

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125929
Log:
	PR middle-end/20623
	* tree.h (debug_fold_checksum): Declared.
	* fold-const.c (build_fold_addr_expr_with_type_1): New.
	(build_fold_addr_expr_with_type, build_fold_addr_expr): Use 
	build_fold_addr_expr_with_type_1.
	(fold_addr_expr, debug_fold_checksum): New.
	(fold_checksum_tree): Don't fold TREE_CHAIN of an SSA_NAME.
	(fold_unary, fold_comparison, split_address_to_core_and_offset):
	Use fold_addr_expr.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/tree.h

Comment 31 Rob 2007-06-24 02:22:54 UTC
(In reply to comment #14)
> *** Bug 32024 has been marked as a duplicate of this bug. ***

32024 is fixed. I would add 4.3.0 to _this_ "Known to work" list if I was able.

Comment 32 Rob 2007-06-24 17:45:48 UTC
Everyone: Don't forget "df", it doesn't slow checking much.


Compile + check time < 16 hours :) only:
--enable-stage1-checking=assert,df,fold,gc,misc,rtl,rtlflag,runtime,tree

Results for 4.3.0 20070623 (experimental) testsuite on i686-pc-linux-gnu
http://gcc.gnu.org/ml/gcc-testresults/2007-06/msg01093.html
Comment 33 Kaveh Ghazi 2007-06-24 18:40:51 UTC
(In reply to comment #32)
> Everyone: Don't forget "df", it doesn't slow checking much.
> Compile + check time < 16 hours :) only:
> --enable-stage1-checking=assert,df,fold,gc,misc,rtl,rtlflag,runtime,tree

To avoid forgetting anything, try "yes,rtl,fold" as your checking options.
Comment 34 Rob 2007-06-25 05:06:48 UTC
(In reply to comment #33)
> (In reply to comment #32)
> > Everyone: Don't forget "df", it doesn't slow checking much.
> > Compile + check time < 16 hours :) only:
> > --enable-stage1-checking=assert,df,fold,gc,misc,rtl,rtlflag,runtime,tree
> To avoid forgetting anything, try "yes,rtl,fold" as your checking options.

Would that enable gcac. Is gcac less useful and very very slow.
Comment 35 Kaveh Ghazi 2007-06-25 05:44:38 UTC
(In reply to comment #34)
> (In reply to comment #33)
> > (In reply to comment #32)
> > > Everyone: Don't forget "df", it doesn't slow checking much.
> > > Compile + check time < 16 hours :) only:
> > > --enable-stage1-checking=assert,df,fold,gc,misc,rtl,rtlflag,runtime,tree
> > To avoid forgetting anything, try "yes,rtl,fold" as your checking options.
> Would that enable gcac. Is gcac less useful and very very slow.

The "yes" option does not invoke "gcac".  It is equivalent to the default on mainline, as if you didn't specify any checking flags.  Look in gcc/configure.ac and search for "gcac" or "rtlflag" and you'll see the shell code in question.
Comment 36 Kaveh Ghazi 2007-06-30 02:16:08 UTC
I tried --enable-checking=yes,fold on sparc-sun-solaris2.10, bootstrap works but I'm still getting a few extra failures.  Here are two testresults from the same checkout, one regular and one with fold checking turned on:

http://gcc.gnu.org/ml/gcc-testresults/2007-06/msg01217.html
http://gcc.gnu.org/ml/gcc-testresults/2007-06/msg01270.html

The differences are:

> FAIL: g++.dg/gomp/atomic-10.C (internal compiler error)
> FAIL: g++.dg/gomp/atomic-4.C (internal compiler error)
> FAIL: gcc.dg/gomp/appendix-a/a.17.1.c (internal compiler error)
> FAIL: gcc.dg/gomp/atomic-10.c (internal compiler error)
> FAIL: gcc.dg/gomp/atomic-4.c (internal compiler error)
> FAIL: libgomp.c/shared-1.c (internal compiler error)
> FAIL: libgomp.c++/pr27337.C  -O0  (internal compiler error)
> FAIL: libgomp.c++/pr27337.C  -O1  (internal compiler error)
> FAIL: libgomp.c++/pr27337.C  -O2  (internal compiler error)
> FAIL: libgomp.c++/pr27337.C  -O3 -fomit-frame-pointer  (internal compiler error)
> FAIL: libgomp.c++/pr27337.C  -O3 -fomit-frame-pointer -funroll-loops  (internal compiler error)
> FAIL: libgomp.c++/pr27337.C  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  (internal compiler error)
> FAIL: libgomp.c++/pr27337.C  -O3 -g  (internal compiler error)
> FAIL: libgomp.c++/pr27337.C  -Os  (internal compiler error)
> FAIL: libgomp.c++/shared-1.C  -O  (internal compiler error)

All of the failures are of the form:

internal compiler error: in fold_checksum_tree, at fold-const.c:12890

I'll create a testcase for one of them.
Comment 37 Kaveh Ghazi 2007-06-30 02:22:58 UTC
Run this in a.17.1.i targetted to sparc-sun-solaris2.10 with --enable-checking=yes,fold and:

cc1 -fpreprocessed a.17.1.i -quiet -dumpbase a.17.1.c -mcpu=v9 -auxbase-strip a.17.1.s -version -fopenmp -fno-show-column -o a.17.1.s

That should show the error.

# 1 "/tmp/kg/basel/egcc-SVN20070627/gcc/testsuite/gcc.dg/gomp/appendix-a/a.17.1.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "/tmp/kg/basel/egcc-SVN20070627/gcc/testsuite/gcc.dg/gomp/appendix-a/a.17.1.c"


void
a17_1_wrong ()
{
  union
  {
    int n;
    float x;
  } u;
#pragma omp parallel
  {
#pragma omp atomic
    u.n++;
#pragma omp atomic
    u.x += 1.0;


  }
}
Comment 38 Kaveh Ghazi 2008-01-26 05:11:37 UTC
Update: mainline appears to pass fold checking albeit with a few extra timeouts due to length compilation times.  However the last fix for fold checking was never backported to the branches.  On 4.1/4.2 I still get these extra fold checking errors due to label addresses:

FAIL: gcc.c-torture/compile/20021108-1.c
FAIL: gcc.c-torture/compile/920501-7.c
FAIL: gcc.c-torture/compile/labels-1.c
FAIL: gcc.c-torture/compile/labels-2.c
FAIL: gcc.c-torture/compile/labels-3.c
FAIL: gcc.dg/20021029-1.c
FAIL: gcc.dg/pr16973.c


Here are the latest results for x86_64-unknown-linux-gnu:
4.1 (extra errors): http://gcc.gnu.org/ml/gcc-testresults/2008-01/msg01221.html
4.2 (extra errors): http://gcc.gnu.org/ml/gcc-testresults/2008-01/msg01222.html

trunk (x86_64 ok): http://gcc.gnu.org/ml/gcc-testresults/2008-01/msg01253.html

I don't have access to solaris any more to see if there are still gomp fold checking failures as from comment #37.

Comment 39 Ryan Mansfield 2009-08-12 14:22:16 UTC
I came across a original-tree-changed-by-fold ICE building libsupc++ for a arm-unknown-linux-gnu target with --enable-checking=fold.

gcc version 4.5.0 20090812 (experimental) [trunk revision 150681] (GCC)

../../../../libstdc++-v3/libsupc++/dyncast.cc: In function 'void* __cxxabiv1::__dynamic_cast(const void*, const __cxxabiv1::__class_type_info*, const __cxxabiv1::__class_type_info*, ptrdiff_t)':
../../../../libstdc++-v3/libsupc++/dyncast.cc:86:1: internal compiler error: fold check: original tree changed by fold
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[4]: *** [dyncast.lo] Error 1
make[4]: Leaving directory `/home/ryan/gcc/trunk/gcc/arm-build/arm-unknown-linux-gnu/libstdc++-v3/libsupc++'
Comment 40 Zdenek Sojka 2010-02-27 14:06:38 UTC
Follown file fails at all opt levels at both x86_64 and i?86:

---------- testcase.cpp ----------
namespace {
  bool bar(int i) { return i; }
}
int foo(int i) { return bar(i) ? i : 0; }
----------------------------------

It was reduced from dyncast.cc (bootstrap fails there).

$ /mnt/sdb1/build-157106-checking-fold/gcc/cc1plus -O1 testcase.cpp
 bool<unnamed>::bar(int) int foo(int)
Analyzing compilation unit
Performing interprocedural optimizations
 <visibility> <*free_lang_data> <early_local_cleanups> <whole-program> <inline> <static-var> <pure-const>Assembling functions:
 int foo(int)
testcase.cpp: In function &#8216;int foo(int)&#8217;:
testcase.cpp:4:5: internal compiler error: fold check: original tree changed by fold
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.