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. Tested on x86_64-pc-linux-gnu, committed on trunk 2019-08-12 Eric Botcazou 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.