diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-21 08:06:20 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-08-21 08:06:20 +0000 |
commit | e3afc2b3e95aecbc2a90b7d7f15cab4e847d7ae4 (patch) | |
tree | b32693bf83d37cce052c0efbf3283c147d1c7a96 | |
parent | e532afed709a571609cfe765870fcc3fb39da11e (diff) |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227053 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/gimple-fold.c | 1 | ||||
-rw-r--r-- | gcc/gimple-match-head.c | 3 |
3 files changed, 13 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 20638852b9f..d7c98837060 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index de64c053f3a..c79f9b3f436 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -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) diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c index 17bd9926144..90f2486e15c 100644 --- a/gcc/gimple-match-head.c +++ b/gcc/gimple-match-head.c @@ -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; |