]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end/106457 - improve array_at_struct_end_p for array objects
authorRichard Biener <rguenther@suse.de>
Thu, 28 Jul 2022 08:07:32 +0000 (10:07 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 28 Jul 2022 12:35:45 +0000 (14:35 +0200)
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.

gcc/tree.cc

index 84000dd8b697ad9cb781ffaf5c2c378d363a8d21..fed1434d141d8297075cece345a5509c3b650b1d 100644 (file)
@@ -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;