]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/ada/ChangeLog
[Ada] Fix internal error on comparison of unaligned slices
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Aug 2019 09:01:33 +0000 (09:01 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Aug 2019 09:01:33 +0000 (09:01 +0000)
commit5d2fb1fafa98e9db71df93130bcd82856abdaba1
treeb23510c1664e59ed694e7ecd7a92ff0171fe8549
parentbb0246a6e8d5e003de6584740012273d73aef252
[Ada] Fix internal error on comparison of unaligned slices

This fixes an internal error in the code generator when it is trying to
take the address of a slice which does not start on a byte boundary, in
order to generate a comparison between slices with a dynamic length.

This case is not supported by the code generator and comes from an
explicit representation clause on a record type, so it must be detected
and handled by the front-end by expanding the comparison on an
element-by-element basis.

2019-08-12  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* exp_ch4.adb (Expand_N_Op_Eq): Expand the array equality if
either operand is a possibly unaligned slice.
* exp_ch6.adb (Expand_Simple_Function_Return): Do not generate a
copy for a possibly unaligned object if it is represented as a
scalar.
* exp_util.adb (Is_Possibly_Unaligned_Slice): Do not always
return false if the target doesn't have strict alignment.

gcc/testsuite/

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@274303 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ada/ChangeLog
gcc/ada/exp_ch4.adb
gcc/ada/exp_ch6.adb
gcc/ada/exp_util.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/slice10.adb [new file with mode: 0644]