aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2004-05-24 16:37:17 +0000
committerUlrich Weigand <uweigand@gcc.gnu.org>2004-05-24 16:37:17 +0000
commitaef0afc4f41cab8148ee17a4ea7dddb6fca0342e (patch)
treef551be5e22d25c37547349ed76c50f067903bb89 /gcc/builtins.c
parenta1db9d9c61bb4c74f5dac30c9d673c84b63c6384 (diff)
downloadgcc-aef0afc4f41cab8148ee17a4ea7dddb6fca0342e.zip
gcc-aef0afc4f41cab8148ee17a4ea7dddb6fca0342e.tar.gz
gcc-aef0afc4f41cab8148ee17a4ea7dddb6fca0342e.tar.bz2
re PR tree-optimization/14197 (Wrong code for bcopy/memmove (string-asm-2.c))
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. From-SVN: r82209
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 2457d66..d56136a 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;
}