diff options
author | uweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-24 16:37:17 +0000 |
---|---|---|
committer | uweigand <uweigand@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-05-24 16:37:17 +0000 |
commit | 9ff0637e4475a9a436506de9d49a6c04b86b2364 (patch) | |
tree | f551be5e22d25c37547349ed76c50f067903bb89 /gcc/builtins.c | |
parent | fe8fb39d2bae23d868f3c5b560a43393fdaba0b7 (diff) | |
download | gcc-9ff0637e4475a9a436506de9d49a6c04b86b2364.tar.gz |
PR tree-optimization/14197
* builtins.c: Include "tree-gimple.h"
(readonly_data_expr): Use get_base_address. Make sure to call
decl_readonly_section only on trees it can handle.
* tree-gimple.c (get_base_address): Accept STRING_CST and
CONSTRUCTOR expressions.
* Makefile.in: Update dependencies.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82209 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 2457d661421..d56136a8804 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -27,6 +27,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "real.h" #include "rtl.h" #include "tree.h" +#include "tree-gimple.h" #include "flags.h" #include "regs.h" #include "hard-reg-set.h" @@ -7925,8 +7926,20 @@ readonly_data_expr (tree exp) { STRIP_NOPS (exp); - if (TREE_CODE (exp) == ADDR_EXPR) - return decl_readonly_section (TREE_OPERAND (exp, 0), 0); + if (TREE_CODE (exp) != ADDR_EXPR) + return false; + + exp = get_base_address (TREE_OPERAND (exp, 0)); + if (!exp) + return false; + + /* Make sure we call decl_readonly_section only for trees it + can handle (since it returns true for everything it doesn't + understand). */ + if (TREE_CODE (exp) == STRING_CST + || TREE_CODE (exp) == CONSTRUCTOR + || (TREE_CODE (exp) == VAR_DECL && TREE_STATIC (exp))) + return decl_readonly_section (exp, 0); else return false; } |