[Ada] Skip overlay checks on protected components with expansion disabled

Pierre-Marie de Rodat derodat@adacore.com
Mon Jun 21 11:05:33 GMT 2021

Routine Find_Overlaid_Entity collects entire objects from prefixes of
attribute Address is overlay specifications. The alignment of those
entire objects are then examined in Validate_Address_Clauses.

However, Find_Overlaid_Entity wrongly collects protected components (and
discriminants of concurrent units), even though they do not represent
entire objects and don't have alignment specified, which causes crashes.

This is only a problem when expansion is disabled, e.g. in GNATprove
mode or when switch -gnatc is used. When expansion is enabled,
references to protected components are rewritten into references to
renamings of components of the implicit concurrent type record.

Since this only affects warnings and not legality checks, it is harmless
to ignore such objects in non-standard compilation modes.

Tested on x86_64-pc-linux-gnu, committed on trunk


	* sem_util.adb (Find_Overlaid_Entity): Ignore references to
	components and discriminants.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 862 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210621/50c4385e/attachment.bin>

More information about the Gcc-patches mailing list