[Ada] Fix awkward placement of freeze node for actual subtype

Message ID 20191010152947.GA87613@adacore.com
State New
Headers show
Series
  • [Ada] Fix awkward placement of freeze node for actual subtype
Related show

Commit Message

Pierre-Marie de Rodat Oct. 10, 2019, 3:29 p.m.
In the case where the tyoe of the formal has a predicate, the compiler
generates a freeze node for the actual subtype of the formal that is
placed just before the declaration of that subtype.  No big deal, but
awkward enough as to warrant a correction.  No functional changes.

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

2019-10-10  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sem_ch6.adb (Set_Actual_Subtypes): Put the freeze node of the
	actual subtype after its declaration when the type of the formal
	has a predicate.

Patch

--- gcc/ada/sem_ch6.adb
+++ gcc/ada/sem_ch6.adb
@@ -12038,7 +12038,7 @@  package body Sem_Ch6 is
             --  predicate may come from an explicit aspect of be inherited.
 
             elsif Has_Predicates (T) then
-               Insert_List_Before_And_Analyze (Decl,
+               Insert_List_After_And_Analyze (Decl,
                  Freeze_Entity (Defining_Identifier (Decl), N));
             end if;