Commit 570d5bbc by Hristian Kirtchev Committed by Pierre-Marie de Rodat

[Ada] Assertion failure on validity check for Address

This patch corrects the verification of 'Address clauses to avoid
processing a clause where the prefix of the attribute is a generic
formal object.

2019-07-08  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not
	register an address clause when its prefix denotes a generic
	formal object.

gcc/testsuite/

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

From-SVN: r273218
parent 47bcd81f
2019-07-08 Hristian Kirtchev <kirtchev@adacore.com> 2019-07-08 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not
register an address clause when its prefix denotes a generic
formal object.
2019-07-08 Hristian Kirtchev <kirtchev@adacore.com>
* bindo-diagnostics.adb (Diagnose_Cycle): Capture the presence * bindo-diagnostics.adb (Diagnose_Cycle): Capture the presence
of an Elaborate_All edge before iterating over the edges of the of an Elaborate_All edge before iterating over the edges of the
cycle. cycle.
......
...@@ -5145,6 +5145,7 @@ package body Sem_Ch13 is ...@@ -5145,6 +5145,7 @@ package body Sem_Ch13 is
-- aspect case properly. -- aspect case properly.
if Is_Object (O_Ent) if Is_Object (O_Ent)
and then not Is_Generic_Formal (O_Ent)
and then not Is_Generic_Type (Etype (U_Ent)) and then not Is_Generic_Type (Etype (U_Ent))
and then Address_Clause_Overlay_Warnings and then Address_Clause_Overlay_Warnings
then then
......
2019-07-08 Hristian Kirtchev <kirtchev@adacore.com>
* gnat.dg/addr13.adb, gnat.dg/addr13.ads: New testcase.
2019-07-08 Ed Schonberg <schonberg@adacore.com> 2019-07-08 Ed Schonberg <schonberg@adacore.com>
* gnat.dg/entry1.adb, gnat.dg/entry1.ads: New testcase. * gnat.dg/entry1.adb, gnat.dg/entry1.ads: New testcase.
......
-- { dg-do compile }
package body Addr13 is
procedure Overlay is
Over : Integer with Address => Gen_Obj'Address;
begin
Over := 123;
end Overlay;
end Addr13;
generic
Gen_Obj : in out Integer;
package Addr13 is
procedure Overlay;
end Addr13;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment