diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2015-03-02 14:49:31 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2015-03-02 14:49:31 +0100 |
commit | cd1a470ab20ef25928fdf69085bb178339872468 (patch) | |
tree | 9d46c92f4ce69ed5e974c9a54999e02732d4fb9c /gcc | |
parent | 89f0276a49a2ae68f3dd086b237037cdce6ed6b4 (diff) | |
download | gcc-cd1a470ab20ef25928fdf69085bb178339872468.zip gcc-cd1a470ab20ef25928fdf69085bb178339872468.tar.gz gcc-cd1a470ab20ef25928fdf69085bb178339872468.tar.bz2 |
[multiple changes]
2015-03-02 Robert Dewar <dewar@adacore.com>
* scng.adb (Scan): Ignore illegal character in relaxed
semantics mode.
2015-03-02 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Analyze_Set_Membership); Retain Overloaded flag
on left operand, so it can be properly resolved with type of
alternatives of right operand.
* sem_res.adb (Resolve_Set_Membership): Handle properly an
overloaded left-hand side when the alternatives on the right
hand side are literals of some universal type. Use first
non-overloaded alternative to find expected type.
2015-03-02 Ed Schonberg <schonberg@adacore.com>
* exp_ch7.adb (Make_Set_Finalize_Address_Call): Use underlying
type to retrieve designated type, because the purported access
type may be a partial (private) view, when it is declared in
the private part of a nested package, and finalization actions
are generated when completing compilation of enclosing unit.
From-SVN: r221116
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 23 | ||||
-rw-r--r-- | gcc/ada/exp_ch7.adb | 13 | ||||
-rw-r--r-- | gcc/ada/scng.adb | 11 | ||||
-rw-r--r-- | gcc/ada/sem_ch4.adb | 4 | ||||
-rw-r--r-- | gcc/ada/sem_res.adb | 28 |
5 files changed, 72 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d5da4d8..6a7a17c 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,28 @@ 2015-03-02 Robert Dewar <dewar@adacore.com> + * scng.adb (Scan): Ignore illegal character in relaxed + semantics mode. + +2015-03-02 Ed Schonberg <schonberg@adacore.com> + + * sem_ch4.adb (Analyze_Set_Membership); Retain Overloaded flag + on left operand, so it can be properly resolved with type of + alternatives of right operand. + * sem_res.adb (Resolve_Set_Membership): Handle properly an + overloaded left-hand side when the alternatives on the right + hand side are literals of some universal type. Use first + non-overloaded alternative to find expected type. + +2015-03-02 Ed Schonberg <schonberg@adacore.com> + + * exp_ch7.adb (Make_Set_Finalize_Address_Call): Use underlying + type to retrieve designated type, because the purported access + type may be a partial (private) view, when it is declared in + the private part of a nested package, and finalization actions + are generated when completing compilation of enclosing unit. + +2015-03-02 Robert Dewar <dewar@adacore.com> + * back_end.adb (Call_Back_End): Remove previous patch, the back end now gets to see the result of -gnatd.1 (Unnest_Subprogram_Mode) processing. diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index a9a242e..52dfb4e 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -7853,10 +7853,19 @@ package body Exp_Ch7 is (Loc : Source_Ptr; Ptr_Typ : Entity_Id) return Node_Id is + + -- It is possible for Ptr_Typ to be a partial view, if the access + -- type is a full view declared in the private part of a nested package, + -- and the finalization actions take place when completing analysis + -- of the enclosing unit. For this reason we use Underlying_Type + -- in two places below. + Desig_Typ : constant Entity_Id := - Available_View (Designated_Type (Ptr_Typ)); + Available_View + (Designated_Type (Underlying_Type (Ptr_Typ))); Fin_Addr : constant Entity_Id := Finalize_Address (Desig_Typ); - Fin_Mas : constant Entity_Id := Finalization_Master (Ptr_Typ); + Fin_Mas : constant Entity_Id := + Finalization_Master (Underlying_Type (Ptr_Typ)); begin -- Both the finalization master and primitive Finalize_Address must be diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index 3e31e5a..7bf8ea2 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -1757,10 +1757,15 @@ package body Scng is then Scan_Ptr := Scan_Ptr + 1; - -- Otherwise we have an illegal comment character + -- Otherwise we have an illegal comment character, ignore + -- this error in relaxed semantics mode. else - Error_Illegal_Character; + if Relaxed_RM_Semantics then + Scan_Ptr := Scan_Ptr + 1; + else + Error_Illegal_Character; + end if; end if; end loop; diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 1d33d1b..c943df1 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -2683,7 +2683,9 @@ package body Sem_Ch4 is if Present (Common_Type) then Set_Etype (L, Common_Type); - Set_Is_Overloaded (L, False); + + -- The left operand may still be overloaded, to be resolved using + -- the Common_Type. else Error_Msg_N ("cannot resolve membership operation", N); diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index de6cef9..69cd339 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -8593,9 +8593,35 @@ package body Sem_Res is procedure Resolve_Set_Membership is Alt : Node_Id; - Ltyp : constant Entity_Id := Etype (L); + Ltyp : Entity_Id; begin + -- If the left operand is overloaded, find type compatible with not + -- overloaded alternative of the right operand. + + if Is_Overloaded (L) then + Ltyp := Empty; + Alt := First (Alternatives (N)); + while Present (Alt) loop + if not Is_Overloaded (Alt) then + Ltyp := Intersect_Types (L, Alt); + exit; + else + Next (Alt); + end if; + end loop; + + -- Unclear how to resolve expression if all alternatives are also + -- overloaded. + + if No (Ltyp) then + Error_Msg_N ("ambiguous expression", N); + end if; + + else + Ltyp := Etype (L); + end if; + Resolve (L, Ltyp); Alt := First (Alternatives (N)); |