Eric Botcazou
2014-10-06 09:40:48 UTC
Hi,
In Ada, we support all sorts of data structure layout, including on strict-
alignment targets, and the compiler must generate glue code if necessary.
The problem here is a function returning a structure by invisible reference
into a field which is not sufficient aligned because the enclosing object is
packed: in this case, the caller passes an address that is not correctly
aligned to the callee, which can result in an unaligned access in the callee.
Tested on x86_64-suse-linux and SPARC/Solaris, OK for the mainline.
2014-10-06 Eric Botcazou <***@adacore.com>
* calls.c (expand_call): Do not use the target as the return slot if
it is not sufficiently aligned.
2014-10-06 Eric Botcazou <***@adacore.com>
* gnat.dg/return4.adb: New test.
* gnat.dg/return4_pkg.ad[sb]: New helper.
In Ada, we support all sorts of data structure layout, including on strict-
alignment targets, and the compiler must generate glue code if necessary.
The problem here is a function returning a structure by invisible reference
into a field which is not sufficient aligned because the enclosing object is
packed: in this case, the caller passes an address that is not correctly
aligned to the callee, which can result in an unaligned access in the callee.
Tested on x86_64-suse-linux and SPARC/Solaris, OK for the mainline.
2014-10-06 Eric Botcazou <***@adacore.com>
* calls.c (expand_call): Do not use the target as the return slot if
it is not sufficiently aligned.
2014-10-06 Eric Botcazou <***@adacore.com>
* gnat.dg/return4.adb: New test.
* gnat.dg/return4_pkg.ad[sb]: New helper.
--
Eric Botcazou
Eric Botcazou