Richard Biener <[email protected]> writes:
> --- 599,615 ----
>
> exp = TREE_OPERAND (exp, 0);
> }
>
> + /* We need to deal with variable arrays ending structures. */
> + if (seen_variable_array_ref
> + && maxsize != -1
> + && (!bit_offset.fits_shwi ()
> + || !host_integerp (TYPE_SIZE (TREE_TYPE (exp)), 1)
> + || (bit_offset.to_shwi () + maxsize
> + == (signed) TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (exp))))))
> + maxsize = -1;
I realise this was in the old code too, but should it be "HOST_WIDE_INT"
rather than "signed"?
Ignore me if not. It just stood out as a bit weird in today's wide-int merge.
Thanks,
Richard
> +
> + done:
> if (!bit_offset.fits_shwi ())
> {
> *poffset = 0;
> *************** get_ref_base_and_extent (tree exp, HOST_
> *** 614,637 ****
>
> hbit_offset = bit_offset.to_shwi ();
>
> - /* We need to deal with variable arrays ending structures such as
> - struct { int length; int a[1]; } x; x.a[d]
> - struct { struct { int a; int b; } a[1]; } x; x.a[d].a
> - struct { struct { int a[1]; } a[1]; } x; x.a[0][d], x.a[d][0]
> - struct { int len; union { int a[1]; struct X x; } u; } x; x.u.a[d]
> - where we do not know maxsize for variable index accesses to
> - the array. The simplest way to conservatively deal with this
> - is to punt in the case that offset + maxsize reaches the
> - base type boundary. This needs to include possible trailing padding
> - that is there for alignment purposes. */
> -
> - if (seen_variable_array_ref
> - && maxsize != -1
> - && (!host_integerp (TYPE_SIZE (base_type), 1)
> - || (hbit_offset + maxsize
> - == (signed) TREE_INT_CST_LOW (TYPE_SIZE (base_type)))))
> - maxsize = -1;
> -
> /* In case of a decl or constant base object we can do better. */
>
> if (DECL_P (exp))