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

Reply via email to