* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
@ 2011-02-01 9:42 ` Joost.VandeVondele at pci dot uzh.ch
2011-02-01 11:53 ` rguenth at gcc dot gnu.org
` (12 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-02-01 9:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
--- Comment #1 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 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
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
2011-02-01 9:42 ` [Bug middle-end/47566] " Joost.VandeVondele at pci dot uzh.ch
@ 2011-02-01 11:53 ` rguenth at gcc dot gnu.org
2011-02-01 12:04 ` Joost.VandeVondele at pci dot uzh.ch
` (11 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-01 11:53 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 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?
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
2011-02-01 9:42 ` [Bug middle-end/47566] " Joost.VandeVondele at pci dot uzh.ch
2011-02-01 11:53 ` rguenth at gcc dot gnu.org
@ 2011-02-01 12:04 ` Joost.VandeVondele at pci dot uzh.ch
2011-02-01 12:12 ` rguenth at gcc dot gnu.org
` (10 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-02-01 12:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
--- Comment #3 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 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)
<var_decl 0x7ffff532eb40 .MEM
type <void_type 0x7ffff7e84d20 void VOID
align 8 symtab 0 alias set -1 structural equality
pointer_to_this <pointer_type 0x7ffff7e84dc8>>
used static external VOID file <built-in> line 0 col 0
align 8>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
` (2 preceding siblings ...)
2011-02-01 12:04 ` Joost.VandeVondele at pci dot uzh.ch
@ 2011-02-01 12:12 ` rguenth at gcc dot gnu.org
2011-02-01 12:23 ` Joost.VandeVondele at pci dot uzh.ch
` (9 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-01 12:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rguenth at gcc dot gnu.org
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 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)
> <var_decl 0x7ffff532eb40 .MEM
> type <void_type 0x7ffff7e84d20 void VOID
> align 8 symtab 0 alias set -1 structural equality
> pointer_to_this <pointer_type 0x7ffff7e84dc8>>
> used static external VOID file <built-in> 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).
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
` (3 preceding siblings ...)
2011-02-01 12:12 ` rguenth at gcc dot gnu.org
@ 2011-02-01 12:23 ` Joost.VandeVondele at pci dot uzh.ch
2011-02-01 12:29 ` Joost.VandeVondele at pci dot uzh.ch
` (8 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-02-01 12:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
--- Comment #5 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
` (4 preceding siblings ...)
2011-02-01 12:23 ` Joost.VandeVondele at pci dot uzh.ch
@ 2011-02-01 12:29 ` Joost.VandeVondele at pci dot uzh.ch
2011-02-01 14:47 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-02-01 12:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
--- Comment #6 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 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
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
` (5 preceding siblings ...)
2011-02-01 12:29 ` Joost.VandeVondele at pci dot uzh.ch
@ 2011-02-01 14:47 ` rguenth at gcc dot gnu.org
2011-02-01 14:54 ` Joost.VandeVondele at pci dot uzh.ch
` (6 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-01 14:47 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
` (6 preceding siblings ...)
2011-02-01 14:47 ` rguenth at gcc dot gnu.org
@ 2011-02-01 14:54 ` Joost.VandeVondele at pci dot uzh.ch
2011-02-01 15:36 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-02-01 14:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
--- Comment #8 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 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).
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
` (7 preceding siblings ...)
2011-02-01 14:54 ` Joost.VandeVondele at pci dot uzh.ch
@ 2011-02-01 15:36 ` rguenth at gcc dot gnu.org
2011-02-01 15:40 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-01 15:36 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
Richard Guenther <rguenth at gcc dot gnu.org> 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 <rguenth at gcc dot gnu.org> 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 <REALPART_EXPR <SAVE_EXPR
<val.767_1280>>>, 2.0e+0) + __builtin_pow (SAVE_EXPR <IMAGPART_EXPR <SAVE_EXPR
<val.767_1280>>>, 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);
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
` (8 preceding siblings ...)
2011-02-01 15:36 ` rguenth at gcc dot gnu.org
@ 2011-02-01 15:40 ` rguenth at gcc dot gnu.org
2011-02-01 15:52 ` Joost.VandeVondele at pci dot uzh.ch
` (3 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-01 15:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
--- Comment #10 from Richard Guenther <rguenth at gcc dot gnu.org> 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; }
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
` (9 preceding siblings ...)
2011-02-01 15:40 ` rguenth at gcc dot gnu.org
@ 2011-02-01 15:52 ` Joost.VandeVondele at pci dot uzh.ch
2011-02-01 21:23 ` Joost.VandeVondele at pci dot uzh.ch
` (2 subsequent siblings)
13 siblings, 0 replies; 15+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-02-01 15:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
--- Comment #11 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 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.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
` (10 preceding siblings ...)
2011-02-01 15:52 ` Joost.VandeVondele at pci dot uzh.ch
@ 2011-02-01 21:23 ` Joost.VandeVondele at pci dot uzh.ch
2011-02-02 9:59 ` rguenth at gcc dot gnu.org
2011-02-02 10:00 ` rguenth at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-02-01 21:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
--- Comment #12 from Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> 2011-02-01 21:00:18 UTC ---
The patch from comment #9 allows a release checking compiler to build CP2K with
LTO.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
` (11 preceding siblings ...)
2011-02-01 21:23 ` Joost.VandeVondele at pci dot uzh.ch
@ 2011-02-02 9:59 ` rguenth at gcc dot gnu.org
2011-02-02 10:00 ` rguenth at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-02 9:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
--- Comment #13 from Richard Guenther <rguenth at gcc dot gnu.org> 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 <rguenther@suse.de>
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
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Bug middle-end/47566] ICE in vn_reference_lookup
2011-02-01 9:38 [Bug middle-end/47566] New: ICE in vn_reference_lookup Joost.VandeVondele at pci dot uzh.ch
` (12 preceding siblings ...)
2011-02-02 9:59 ` rguenth at gcc dot gnu.org
@ 2011-02-02 10:00 ` rguenth at gcc dot gnu.org
13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-02-02 10:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47566
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.6.0
--- Comment #14 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-02-02 10:00:49 UTC ---
Fixed.
^ permalink raw reply [flat|nested] 15+ messages in thread