[Ada] Fix wrong value of 'Size for slices of bit-packed arrays (2)
Pierre-Marie de Rodat
derodat@adacore.com
Thu Dec 12 10:04:00 GMT 2019
This completes the previous fix, which is not sufficient when the Size
attribute is applied to a formal object of mode In Out and the generic
is instantiated on a slice of a bit-packed array whose size is not a
multiple of the storage unit.
The hurdle here is that introducing a temporary may change the value
of the Size attribute, because a temporary is a stand-alone object and
the size of stand-alone objects is always a multiple of the storage
unit with GNAT.
Instead of trying to look through them in Expand_Size_Attribute, this
changes the expansion done by Expand_N_Slice to avoid creating these
problematic temporaries for slices of bit-packed arrays that are the
prefix of the Size attribute.
Tested on x86_64-pc-linux-gnu, committed on trunk
2019-12-12 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* exp_attr.adb (Expand_Size_Attribute): Look directly at the
prefix to detect the bit-packed slices. Apply the checks last
in case the attribute needs to be processed by the back-end.
* exp_ch4.adb (Expand_N_Slice): Do not create a temporary for
a prefix of the Size attribute.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 1988 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191212/babc9b50/attachment.bin>
More information about the Gcc-patches
mailing list