diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-08-26 18:39:26 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-08-26 18:39:26 +0200 |
commit | 9e3920e97f0cc9df385cf357f4d123564e0da7ad (patch) | |
tree | 4842034f20c95beead33bfbf7d7f7eef7bca0017 /gcc/calls.c | |
parent | 350b70702451004bf3f8b7e520b95728bc98cf28 (diff) | |
download | gcc-9e3920e97f0cc9df385cf357f4d123564e0da7ad.zip gcc-9e3920e97f0cc9df385cf357f4d123564e0da7ad.tar.gz gcc-9e3920e97f0cc9df385cf357f4d123564e0da7ad.tar.bz2 |
re PR tree-optimization/44485 (ICE in get_expr_operands, at tree-ssa-operands.c:1020)
PR tree-optimization/44485
* calls.c (flags_from_decl_or_type): For const or pure
noreturn functions return ECF_LOOPING_CONST_OR_PURE|ECF_NORETURN
together with ECF_CONST resp. ECF_PURE.
* builtins.c (expand_builtin): Use flags_from_decl_or_type
instead of querying flags directly.
* tree-ssa-loop-niter.c (finite_loop_p): Likewise.
* tree-ssa-dce.c (find_obviously_necessary_stmts): Likewise.
* gcc.dg/pr44485.c: New test.
From-SVN: r163568
Diffstat (limited to 'gcc/calls.c')
-rw-r--r-- | gcc/calls.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index cd0d9c5..c50a792 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -601,7 +601,7 @@ flags_from_decl_or_type (const_tree exp) flags |= ECF_RETURNS_TWICE; /* Process the pure and const attributes. */ - if (TREE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp)) + if (TREE_READONLY (exp)) flags |= ECF_CONST; if (DECL_PURE_P (exp)) flags |= ECF_PURE; @@ -616,11 +616,15 @@ flags_from_decl_or_type (const_tree exp) flags = special_function_p (exp, flags); } - else if (TYPE_P (exp) && TYPE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp)) + else if (TYPE_P (exp) && TYPE_READONLY (exp)) flags |= ECF_CONST; if (TREE_THIS_VOLATILE (exp)) - flags |= ECF_NORETURN; + { + flags |= ECF_NORETURN; + if (flags & (ECF_CONST|ECF_PURE)) + flags |= ECF_LOOPING_CONST_OR_PURE; + } return flags; } |