Fix incorrect handling of Component_Size
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 25 May 2020 08:04:10 +0000 (10:04 +0200)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 25 May 2020 08:07:04 +0000 (10:07 +0200)
commit15c55b96a721721e944f8617ae59bdcb273477e6
tree40aa466d1503dd1bba7908b0160e7acd51950a3f
parentdeea3defc9802fcf3f8ea4e45f29dd1ad8fb3cef
Fix incorrect handling of Component_Size

The compiler can mishandle a Component_Size clause on an array type
specifying a size multiple of the storage unit, when this size is
not a multiple of the alignment of the component type.

gcc/ada/ChangeLog
* gcc-interface/decl.c (gnat_to_gnu_component_type): Cap alignment
of the component type according to the component size.

gcc/testsuite/ChangeLog
* gnat.dg/array40.adb: New test.
* gnat.dg/array40_pkg.ads: New helper.
gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/array40.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array40_pkg.ads [new file with mode: 0644]