aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-09-06 11:47:50 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-09-06 11:47:50 +0200
commit6376a3c640009ed25a250d677fc7ff0fdd0a2c1c (patch)
tree83a5026f78a61947711ce133b262c40c83dc2a81
parent8489c2956a08a7397d80cc21f67c1a1064c14cdc (diff)
downloadgcc-6376a3c640009ed25a250d677fc7ff0fdd0a2c1c.zip
gcc-6376a3c640009ed25a250d677fc7ff0fdd0a2c1c.tar.gz
gcc-6376a3c640009ed25a250d677fc7ff0fdd0a2c1c.tar.bz2
[multiple changes]
2017-09-06 Ed Schonberg <schonberg@adacore.com> * sem_attr.adb (Analyze_Attribute, case 'Loop_Entry): Handle properly an attribute reference 'Loop_Entry that appears in the list of indices of an indexed expression, to prevent an infinite loop in the compiler. 2017-09-06 Bob Duff <duff@adacore.com> * s-fileio.adb (Name): Do not raise Use_Error for temp files. 2017-09-06 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Set_Membership): If an alternative in a set membership is an overloaded enumeration literal, and the type of the alternative is resolved from a previous one, replace the entity of the alternative as well as the type, to prevent inconsistencies between the entity and the type. From-SVN: r251761
-rw-r--r--gcc/ada/ChangeLog19
-rw-r--r--gcc/ada/s-fileio.adb2
-rw-r--r--gcc/ada/sem_attr.adb9
-rw-r--r--gcc/ada/sem_ch4.adb9
4 files changed, 36 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 9745330..19a6d3a 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,22 @@
+2017-09-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_attr.adb (Analyze_Attribute, case 'Loop_Entry): Handle
+ properly an attribute reference 'Loop_Entry that appears in the
+ list of indices of an indexed expression, to prevent an infinite
+ loop in the compiler.
+
+2017-09-06 Bob Duff <duff@adacore.com>
+
+ * s-fileio.adb (Name): Do not raise Use_Error for temp files.
+
+2017-09-06 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch4.adb (Analyze_Set_Membership): If an alternative
+ in a set membership is an overloaded enumeration literal, and
+ the type of the alternative is resolved from a previous one,
+ replace the entity of the alternative as well as the type,
+ to prevent inconsistencies between the entity and the type.
+
2017-09-06 Eric Botcazou <ebotcazou@adacore.com>
* ali.ads (ALIs_Record): Add No_Component_Reordering component.
diff --git a/gcc/ada/s-fileio.adb b/gcc/ada/s-fileio.adb
index 6c44938..c8b44bd 100644
--- a/gcc/ada/s-fileio.adb
+++ b/gcc/ada/s-fileio.adb
@@ -742,8 +742,6 @@ package body System.File_IO is
begin
if File = null then
raise Status_Error with "Name: file not open";
- elsif File.Is_Temporary_File then
- raise Use_Error with "Name: temporary file has no name";
else
return File.Name.all (1 .. File.Name'Length - 1);
end if;
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 18107fc..d7ee88e 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -4377,7 +4377,14 @@ package body Sem_Attr is
-- When the attribute is part of an indexed component, find the first
-- expression as it will determine the semantics of 'Loop_Entry.
- if Nkind (Context) = N_Indexed_Component then
+ -- If the attribute is itself an index in an indexed component, i.e.
+ -- a member of a list, the context itself is not relevant (the code
+ -- below would lead to an infinite loop) and the attribute applies
+ -- to the enclosing loop.
+
+ if Nkind (Context) = N_Indexed_Component
+ and then not Is_List_Member (N)
+ then
E1 := First (Expressions (Context));
E2 := Next (E1);
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 3b0717c..cb50ee7 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -2935,11 +2935,20 @@ package body Sem_Ch4 is
-- for all of them.
Set_Etype (Alt, It.Typ);
+
+ -- If the alternative is an enumeration literal, use
+ -- the one for this interpretation.
+
+ if Is_Entity_Name (Alt) then
+ Set_Entity (Alt, It.Nam);
+ end if;
+
Get_Next_Interp (Index, It);
if No (It.Typ) then
Set_Is_Overloaded (Alt, False);
Common_Type := Etype (Alt);
+
end if;
Candidate_Interps := Alt;