public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/47566] ICE in vn_reference_lookup
Date: Tue, 01 Feb 2011 15:36:00 -0000	[thread overview]
Message-ID: <bug-47566-4-bqHg3yvqr4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-47566-4@http.gcc.gnu.org/bugzilla/>

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


  parent reply	other threads:[~2011-02-01 15:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-01  9:38 [Bug middle-end/47566] New: " 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
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
2011-02-01 14:54 ` Joost.VandeVondele at pci dot uzh.ch
2011-02-01 15:36 ` rguenth at gcc dot gnu.org [this message]
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
2011-02-02  9:59 ` rguenth at gcc dot gnu.org
2011-02-02 10:00 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-47566-4-bqHg3yvqr4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).