[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 6 Sep 2017 09:47:50 +0000 (11:47 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 6 Sep 2017 09:47:50 +0000 (11:47 +0200)
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

gcc/ada/ChangeLog
gcc/ada/s-fileio.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_ch4.adb

index 9745330..19a6d3a 100644 (file)
@@ -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.
index 6c44938..c8b44bd 100644 (file)
@@ -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;
index 18107fc..d7ee88e 100644 (file)
@@ -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);
 
index 3b0717c..cb50ee7 100644 (file)
@@ -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;