r275769 - in /trunk/gcc: ada/ChangeLog ada/exp_...

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Tue Sep 17 07:59:00 GMT 2019


Author: pmderodat
Date: Tue Sep 17 07:59:16 2019
New Revision: 275769

URL: https://gcc.gnu.org/viewcvs?rev=275769&root=gcc&view=rev
Log:
[Ada] Fix wrong value of 'Size for slices of bit-packed arrays

This fixes a long-standing issue in the compiler which would return
a wrong value for the Size attribute applied to slices of bit-packed
arrays whose size is not a multiple of the storage unit.

The problem is that the computation was done in the code generator
after the bit-packed array had been internally rewritten into an
array of bytes, so the Size was always rounded up to the next byte.

The computation is now rewritten into the product of the Length and
Compnent_Size attribute of the slices before being sent to the code
generator.

2019-09-17  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_attr.adb (Expand_Size_Attribute): Chain the special cases
	on the back-end path and rewrite the attribute appled to slices
	of bit-packed arrays into the product of the Length and the
	Compoent_Size attributes of the slices.
	* exp_ch5.adb (Expand_Assign_Array_Bitfield): Use Size attribute
	directly to compute the bitfield's size.

gcc/testsuite/

	* gnat.dg/pack25.adb: New testcase.

Added:
    trunk/gcc/testsuite/gnat.dg/pack25.adb
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/exp_attr.adb
    trunk/gcc/ada/exp_ch5.adb
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-cvs mailing list