gcc/ChangeLog:
* builtins.c (compute_objsize): Adjust offset by the array low bound.
From-SVN: r279445
+2019-12-16 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/92952
+ * builtins.c (compute_objsize): Adjust offset by the array low bound.
+
2019-12-16 David Malcolm <dmalcolm@redhat.com>
* pretty-print.c (pp_write_text_as_html_like_dot_to_stream): New
above. */
if (TREE_CODE (dest) == ARRAY_REF)
{
+ tree lowbnd = array_ref_low_bound (dest);
+ if (!integer_zerop (lowbnd) && tree_fits_uhwi_p (lowbnd))
+ {
+ /* Adjust the offset by the low bound of the array
+ domain (normally zero but 1 in Fortran). */
+ unsigned HOST_WIDE_INT lb = tree_to_uhwi (lowbnd);
+ offrng[0] -= lb;
+ offrng[1] -= lb;
+ }
+
/* Convert the array index into a byte offset. */
tree eltype = TREE_TYPE (dest);
tree tpsize = TYPE_SIZE_UNIT (eltype);