From: charlet Date: Thu, 31 Jul 2014 09:54:35 +0000 (+0000) Subject: 2014-07-31 Ed Schonberg X-Git-Tag: upstream/5.3.0~6765 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=42da1141378df2fe07baf9877597429c6d463467;p=platform%2Fupstream%2Flinaro-gcc.git 2014-07-31 Ed Schonberg * sem_ch5.adb (Analyze_Iterator_Specification): If the domain of iteration is an array component that depends on discriminants, create an actual subtype for it, because the preanalysis of the iterator name does not create actual subtypes of components. 2014-07-31 Hristian Kirtchev * freeze.adb (Freeze_Expression): Update the loop in charge of finding a proper insertion place for freeze nodes to handle N_Expression_With_Actions nodes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213333 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 444aed2..d8f1bbb 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2014-07-31 Hristian Kirtchev + + * freeze.adb (Freeze_Expression): Update the loop in charge + of finding a proper insertion place for freeze nodes to handle + N_Expression_With_Actions nodes. + 2014-07-31 Robert Dewar * sem_util.adb, a-ngelfu.ads, prj-nmsc.adb, prj-conf.adb: Minor diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 99464b8..fb1b904 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -6143,13 +6143,26 @@ package body Freeze is exit when Is_List_Member (P); - -- Note: The N_Loop_Statement is a special case. A type that - -- appears in the source can never be frozen in a loop (this - -- occurs only because of a loop expanded by the expander), so we - -- keep on going. Otherwise we terminate the search. Same is true - -- of any entity which comes from source. (if they have predefined - -- type, that type does not appear to come from source, but the - -- entity should not be frozen here). + -- Freeze nodes produced by an expression coming from the Actions + -- list of a N_Expression_With_Actions node must remain within the + -- Actions list. Inserting the freeze nodes further up the tree + -- may lead to use before declaration issues in the case of array + -- types. + + when N_Expression_With_Actions => + if Is_List_Member (P) + and then List_Containing (P) = Actions (Parent_P) + then + exit; + end if; + + -- Note: N_Loop_Statement is a special case. A type that appears + -- in the source can never be frozen in a loop (this occurs only + -- because of a loop expanded by the expander), so we keep on + -- going. Otherwise we terminate the search. Same is true of any + -- entity which comes from source. (if they have predefined type, + -- that type does not appear to come from source, but the entity + -- should not be frozen here). when N_Loop_Statement => exit when not Comes_From_Source (Etype (N)) diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb index a961bb7..8bf9df7 100644 --- a/gcc/ada/sem_ch5.adb +++ b/gcc/ada/sem_ch5.adb @@ -1750,11 +1750,33 @@ package body Sem_Ch5 is and then not ASIS_Mode then declare - Id : constant Entity_Id := Make_Temporary (Loc, 'R', Iter_Name); - Decl : Node_Id; + Id : constant Entity_Id := Make_Temporary (Loc, 'R', Iter_Name); + Decl : Node_Id; + Act_S : Node_Id; begin - Typ := Etype (Iter_Name); + + -- If the domain of iteration is an array component that depends + -- on a discriminant, create actual subtype for it. Pre-analysis + -- does not generate the actual subtype of a selected component. + + if Nkind (Iter_Name) = N_Selected_Component + and then Is_Array_Type (Etype (Iter_Name)) + then + Act_S := + Build_Actual_Subtype_Of_Component + (Etype (Selector_Name (Iter_Name)), Iter_Name); + Insert_Action (N, Act_S); + + if Present (Act_S) then + Typ := Defining_Identifier (Act_S); + else + Typ := Etype (Iter_Name); + end if; + + else + Typ := Etype (Iter_Name); + end if; -- Protect against malformed iterator