diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-13 10:20:57 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-06-13 10:20:57 +0000 |
commit | b2f0b2a33f40ea27f6f1f130f0e20a3aa44eb02c (patch) | |
tree | ffb72b25b3366639abc607ceaa8c9633577cdf14 /gcc/builtins.c | |
parent | 56f06eefe91d32c510a389a65078d2b040ca8108 (diff) | |
download | gcc-b2f0b2a33f40ea27f6f1f130f0e20a3aa44eb02c.tar.gz |
PR middle-end/36520
* builtins.c (get_memory_rtx): Test for the presence of DECL_SIZE_UNIT
before evaluating it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136747 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index edc5d5f07f3..b3fc3041377 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -1125,14 +1125,16 @@ get_memory_rtx (tree exp, tree len) && (TREE_INT_CST_LOW (DECL_SIZE (field)) % BITS_PER_UNIT) == 0)); + /* If we can prove that the memory starting at XEXP (mem, 0) and + ending at XEXP (mem, 0) + LENGTH will fit into this field, we + can keep the COMPONENT_REF in MEM_EXPR. But be careful with + fields without DECL_SIZE_UNIT like flexible array members. */ if (length >= 0 + && DECL_SIZE_UNIT (field) && host_integerp (DECL_SIZE_UNIT (field), 0)) { HOST_WIDE_INT size = TREE_INT_CST_LOW (DECL_SIZE_UNIT (field)); - /* If we can prove the memory starting at XEXP (mem, 0) - and ending at XEXP (mem, 0) + LENGTH will fit into - this field, we can keep that COMPONENT_REF in MEM_EXPR. */ if (offset <= size && length <= size && offset + length <= size) |