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

pmderodat@gcc.gnu.org pmderodat@gcc.gnu.org
Mon May 28 08:54:00 GMT 2018


Author: pmderodat
Date: Mon May 28 08:54:55 2018
New Revision: 260834

URL: https://gcc.gnu.org/viewcvs?rev=260834&root=gcc&view=rev
Log:
[Ada] Fix internal error on nested record types with representation clause

This fixes a long-standing issue with the expansion of equality functions
generated for discriminated record types with variant part.  In this case
the front-end recursively expands equality functions for the composite
sub-components, in particular the array sub-components.

But it systematically uses the unconstrained base type for them, which leads
to both a more complex equality function, because of the need to compare
the bounds, and an additional unchecked conversion from type to base type.

Now this unchecked conversion may block a further expansion of the array
sub-component, for example if it is a large array of record types subject
to a component clause that causes it not to start on a byte boundary, and
thus may lead to an internal error downstream in the back-end.

2018-05-28  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* exp_ch4.adb (Expand_Composite_Equality): For a composite (or FP)
	component type, do not expand array equality using the unconstrained
	base type, except for the case where the bounds of the type depend on a
	discriminant.

gcc/testsuite/

	* gnat.dg/rep_clause6.adb, gnat.dg/rep_clause6.ads: New testcase.

Added:
    trunk/gcc/testsuite/gnat.dg/rep_clause6.adb
    trunk/gcc/testsuite/gnat.dg/rep_clause6.ads
Modified:
    trunk/gcc/ada/ChangeLog
    trunk/gcc/ada/exp_ch4.adb
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-cvs mailing list