aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-07-28 10:07:32 +0200
committerRichard Biener <rguenther@suse.de>2022-07-28 14:35:45 +0200
commitff26f0ba68fe6e870f315d0601b596f889b89680 (patch)
tree8112fe38d2b19e4c00ca3e37c1165c1089abd0d3 /gcc/tree.cc
parentf64eb636677d714781b4543f111b1c9239328db6 (diff)
downloadgcc-ff26f0ba68fe6e870f315d0601b596f889b89680.zip
gcc-ff26f0ba68fe6e870f315d0601b596f889b89680.tar.gz
gcc-ff26f0ba68fe6e870f315d0601b596f889b89680.tar.bz2
middle-end/106457 - improve array_at_struct_end_p for array objects
Array references to array objects are never at struct end. PR middle-end/106457 * tree.cc (array_at_struct_end_p): Handle array objects specially.
Diffstat (limited to 'gcc/tree.cc')
-rw-r--r--gcc/tree.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 84000dd..fed1434 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -12778,6 +12778,10 @@ array_at_struct_end_p (tree ref)
&& DECL_SIZE_UNIT (ref)
&& TREE_CODE (DECL_SIZE_UNIT (ref)) == INTEGER_CST)
{
+ /* If the object itself is the array it is not at struct end. */
+ if (DECL_P (ref_to_array))
+ return false;
+
/* Check whether the array domain covers all of the available
padding. */
poly_int64 offset;