Skip to content
Snippets Groups Projects
Commit 85f0ae3c authored by Steve Baird's avatar Steve Baird Committed by Marc Poulhiès
Browse files

ada: Error compiling Ada 2022 object renaming with no subtype mark

In some cases the compiler would crash or generate spurious errors
compiling a legal object renaming declaration that lacks a subtype mark.
In addition to fixing the immediate problem, change Atree.Copy_Slots
so that attempts to modify either the Empty or the Error nodes
(e.g., by passing one of them as the target in a call to Rewrite)
are ineffective. Cope with the consequences of this.

gcc/ada/

	* sem_ch8.adb (Check_Constrained_Object): Before updating the
	subtype mark of an object renaming declaration by calling Rewrite,
	first check whether the destination of the Rewrite call exists.
	* atree.adb (Copy_Slots): Return without performing any updates if
	Destination equals Empty or Error, or if Source equals Empty. Any
	of those conditions indicates an error case.
	* sem_ch12.adb (Analyze_Formal_Derived_Type): Avoid cascading
	errors.
	* sem_ch3.adb (Analyze_Number_Declaration): In an error case, do
	not pass Error as destination in a call to Rewrite.
	(Find_Type_Of_Subtype_Indic): In an error case, do not pass Error
	or Empty as destination in a call to Rewrite.
parent c1ebec34
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment