[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 Richard Guenther changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED Target Milestone|--- |4.6.0 --- Comment #14 from Richard Guenther 2011-02-02 10:00:49 UTC --- Fixed.
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 --- Comment #13 from Richard Guenther 2011-02-02 09:59:29 UTC --- Author: rguenth Date: Wed Feb 2 09:59:23 2011 New Revision: 169518 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169518 Log: 2011-02-02 Richard Guenther PR tree-optimization/47566 * builtins.c (builtin_save_expr): No SAVE_EXPR for SSA_NAMEs. * gcc.dg/lto/20110201-1_0.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/lto/20110201-1_0.c Modified: trunk/gcc/ChangeLog trunk/gcc/builtins.c trunk/gcc/testsuite/ChangeLog
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 --- Comment #12 from Joost VandeVondele 2011-02-01 21:00:18 UTC --- The patch from comment #9 allows a release checking compiler to build CP2K with LTO.
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 --- Comment #11 from Joost VandeVondele 2011-02-01 15:52:42 UTC --- (In reply to comment #9) > In file included from :425:0: > /tmp/cp2k/makefiles/../src/realspace_grid_types.F: In function > 'rs_pw_transfer_replicated': > /tmp/cp2k/makefiles/../src/realspace_grid_types.F:816:0: error: non-trivial > conversion at assignment yes, that is PR45586. Can be worked around with either release checking (which I have enable right now) or changing src/realspace_grid_types.F to use REAL(KIND=dp), DIMENSION ( :, :, : ), POINTER :: r ! the grid instead of REAL(KIND=dp), DIMENSION ( :, :, : ), ALLOCATABLE :: r ! the grid > The following fixes the ICE for me: cool.
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 --- Comment #10 from Richard Guenther 2011-02-01 15:40:30 UTC --- Testcase: /* { dg-lto-do run } */ /* { dg-extra-ld-options "-O2 -ffast-math" } */ double cabs(_Complex double); double __attribute__((used)) foo (_Complex double x, int b) { if (b) x = 0; return cabs(x); } int main() { return 0; }
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 Richard Guenther changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Last reconfirmed||2011.02.01 15:36:11 AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #9 from Richard Guenther 2011-02-01 15:36:11 UTC --- I can reproduce it. I also run into In file included from :425:0: /tmp/cp2k/makefiles/../src/realspace_grid_types.F: In function 'rs_pw_transfer_replicated': /tmp/cp2k/makefiles/../src/realspace_grid_types.F:816:0: error: non-trivial conversion at assignment struct array3_real(kind=8) struct array3_real(kind=8) # .MEM_755 = VDEF <.MEM_649> grid = D.39399_277->r; and a couple of similar ICEs in other ltrans units. Probably the known restrict vs. non-restrict bug. The bug happens when optimizing fft3d_pb, it also happens with -fno-inline so indeed the bug might be triggered by the mix of -O0 and -O3 (thus, by not running early optimizations). Seems to be -ffast-math vs. non-fast-math. We fold calls during PRE insertion which turns cabs into components (complex lowering). That folding, folded = build_call_array (currop->type, (TREE_CODE (fn) == FUNCTION_DECL ? build_fold_addr_expr (fn) : fn), nargs, args); can create arbitrary number of expressions, including for some reason non-gimple reg vars. In particular fold_builtin_cabs returns __builtin_sqrt (__builtin_pow (SAVE_EXPR >>, 2.0e+0) + __builtin_pow (SAVE_EXPR >>, 2.0e+0)) and then save-expr gimplification introduces the non-register temporary as a result of SSA_NAME save-expr (which is unnecessary anyway). The following fixes the ICE for me: Index: builtins.c === --- builtins.c (revision 169476) +++ builtins.c (working copy) @@ -652,9 +652,10 @@ target_char_cast (tree cst, char *p) static tree builtin_save_expr (tree exp) { - if (TREE_ADDRESSABLE (exp) == 0 - && (TREE_CODE (exp) == PARM_DECL - || (TREE_CODE (exp) == VAR_DECL && !TREE_STATIC (exp + if (TREE_CODE (exp) == SSA_NAME + || (TREE_ADDRESSABLE (exp) == 0 + && (TREE_CODE (exp) == PARM_DECL + || (TREE_CODE (exp) == VAR_DECL && !TREE_STATIC (exp) return exp; return save_expr (exp);
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 --- Comment #8 from Joost VandeVondele 2011-02-01 14:53:44 UTC --- (In reply to comment #7) > Hm, you are using -O0 for the compile and -O3 ... for the link step? Should > work in theory, but of course isn't tested thoroughly. Right :-) I'm trying to test this thoroughly... seems like a useful trick to speedup parallel builds of Fortran programs (quick -O0 build to satisfy module dependencies, massively parallel and thus hopefully fast lto without the dependencies).
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 --- Comment #7 from Richard Guenther 2011-02-01 14:46:56 UTC --- Hm, you are using -O0 for the compile and -O3 ... for the link step? Should work in theory, but of course isn't tested thoroughly.
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 --- Comment #6 from Joost VandeVondele 2011-02-01 12:29:36 UTC --- to reproduce from sources wget http://www.pci.uzh.ch/vandevondele/tmp/cp2k.tgz tar -xzvf cp2k.tgz cd cp2k/makefiles make -j ARCH=gfortran-test24 VERSION=sopt this assumes that you have lapack and blas installed etc. The file cp2k/arch/gfortran-test24.sopt can be changed to modify compile options (or directories for lapack/blas). With make -j ARCH=gfortran-test24 VERSION=sopt distclean a new build can be started from scratch
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 --- Comment #5 from Joost VandeVondele 2011-02-01 12:23:35 UTC --- (In reply to comment #4) > That's indeed invalid - it should be an SSA name. This means some > earlier pass messed up (or PRE itself). The bug shouldn't depend > on LTO (apart from maybe requiring some cross-module inlining to trigger). The same problem doesn't happen without LTO (but otherwise compiled with the same options). I guess it needs the cross-module inlining. I'll be uploading a tgz with sources.
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 Richard Guenther changed: What|Removed |Added CC||rguenth at gcc dot gnu.org --- Comment #4 from Richard Guenther 2011-02-01 12:12:13 UTC --- (In reply to comment #3) > (In reply to comment #2) > > I think we need source code (LTO bytecode isn't really portable). > > oops... that's building CP2K. Let me see if I can reproduce this with this > night's tarball. > > > > > (gdb) call debug_tree (vuse) > > > > at that point? > > (gdb) call debug_tree (vuse) > type align 8 symtab 0 alias set -1 structural equality > pointer_to_this > > used static external VOID file line 0 col 0 > align 8> That's indeed invalid - it should be an SSA name. This means some earlier pass messed up (or PRE itself). The bug shouldn't depend on LTO (apart from maybe requiring some cross-module inlining to trigger).
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 --- Comment #3 from Joost VandeVondele 2011-02-01 12:04:46 UTC --- (In reply to comment #2) > I think we need source code (LTO bytecode isn't really portable). oops... that's building CP2K. Let me see if I can reproduce this with this night's tarball. > > (gdb) call debug_tree (vuse) > > at that point? (gdb) call debug_tree (vuse) > used static external VOID file line 0 col 0 align 8>
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 --- Comment #2 from Richard Guenther 2011-02-01 11:53:09 UTC --- I think we need source code (LTO bytecode isn't really portable). It looks like that vuse is somehow bogus - mind posting the output of (gdb) call debug_tree (vuse) at that point?
[Bug middle-end/47566] ICE in vn_reference_lookup
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566 --- Comment #1 from Joost VandeVondele 2011-02-01 09:42:12 UTC --- gzipped testcase (2.7Mb) downloadable from http://www.pci.uzh.ch/vandevondele/tmp/cp2k.sopt.ltrans1.o.gz