re PR middle-end/67285 (ICE with (rdiv (POW:s @0 REAL_CST@1) @0))
authorRichard Biener <rguenther@suse.de>
Fri, 21 Aug 2015 08:06:20 +0000 (08:06 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 21 Aug 2015 08:06:20 +0000 (08:06 +0000)
2015-08-21  Richard Biener  <rguenther@suse.de>

PR middle-end/67285
* gimple-fold.c (replace_stmt_with_simplification): Assert
seq is empty when replacing a call with itself but different
arguments.
* gimple-match-head.c (maybe_push_res_to_seq): When pushing
a call require that it is const.

From-SVN: r227053

gcc/ChangeLog
gcc/gimple-fold.c
gcc/gimple-match-head.c

index 20638852b9f78552d576e0ce001073e7815891c4..d7c988370605ffe19d578d94d36ce918602ad8b3 100644 (file)
@@ -1,3 +1,12 @@
+2015-08-21  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/67285
+       * gimple-fold.c (replace_stmt_with_simplification): Assert
+       seq is empty when replacing a call with itself but different
+       arguments.
+       * gimple-match-head.c (maybe_push_res_to_seq): When pushing
+       a call require that it is const.
+
 2015-08-20  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>
 
        * defaults.h (CONSTANT_ALIGNMENT): New macro definition.
index de64c053f3a55d51da98401922d0dc22079e0880..c79f9b3f436ef448e0b0f2c738347155e811d6a9 100644 (file)
@@ -3308,6 +3308,7 @@ replace_stmt_with_simplification (gimple_stmt_iterator *gsi,
        }
       if (i < 3)
        gcc_assert (ops[i] == NULL_TREE);
+      gcc_assert (gimple_seq_empty_p (*seq));
       return true;
     }
   else if (!inplace)
index 17bd992614422f4e3d09ba0d9ba3e02a7bf183c2..90f2486e15c36f2e34aee85643fbe62d1eeea2e8 100644 (file)
@@ -338,6 +338,9 @@ maybe_push_res_to_seq (code_helper rcode, tree type, tree *ops,
       tree decl = builtin_decl_implicit (rcode);
       if (!decl)
        return NULL_TREE;
+      /* We can't and should not emit calls to non-const functions.  */
+      if (!(flags_from_decl_or_type (decl) & ECF_CONST))
+       return NULL_TREE;
       /* Play safe and do not allow abnormals to be mentioned in
          newly created statements.  */
       unsigned nargs;