[Ada] Crash on ghost assignment check for illegal code
authorBob Duff <duff@adacore.com>
Sun, 8 Nov 2020 21:54:56 +0000 (16:54 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 30 Nov 2020 14:16:16 +0000 (09:16 -0500)
gcc/ada/

* errout.adb (Error_Msg_NEL): Do not call Set_Posted if errors
are being ignored.
(Error_Msg): Change Errors_Must_Be_Ignored to use the getter.
* sem_ch8.adb (Find_Direct_Name): Do not skip all the error
checks when ignoring errors, but instead do not add an entry to
the Urefs table if errors are being ignored.
* exp_ch5.adb: Minor comment fix.

gcc/ada/errout.adb
gcc/ada/exp_ch5.adb
gcc/ada/sem_ch8.adb

index 049db89..fbbf579 100644 (file)
@@ -337,7 +337,7 @@ package body Errout is
    begin
       --  Return if all errors are to be ignored
 
-      if Errors_Must_Be_Ignored then
+      if Get_Ignore_Errors then
          return;
       end if;
 
@@ -1430,7 +1430,9 @@ package body Errout is
          Last_Killed := True;
       end if;
 
-      Set_Posted (N);
+      if not Get_Ignore_Errors then
+         Set_Posted (N);
+      end if;
    end Error_Msg_NEL;
 
    ------------------
index 93351cf..e720656 100644 (file)
@@ -1469,7 +1469,7 @@ package body Exp_Ch5 is
       --  there are volatile or independent components. If the Prefix of the
       --  slice is a component or slice, then it might be a part of an object
       --  with some other volatile or independent components, so we disable the
-      --  optimization in that case as well.  We could complicate this code by
+      --  optimization in that case as well. We could complicate this code by
       --  actually looking for such volatile and independent components.
 
       if Is_Bit_Packed_Array (L_Type)
index f78d31a..07484d5 100644 (file)
@@ -5622,7 +5622,10 @@ package body Sem_Ch8 is
          --  undefined reference. The entry is not added if we are ignoring
          --  errors.
 
-         if not All_Errors_Mode and then Ignore_Errors_Enable = 0 then
+         if not All_Errors_Mode
+           and then Ignore_Errors_Enable = 0
+           and then not Get_Ignore_Errors
+         then
             Urefs.Append (
               (Node => N,
                Err  => Emsg,
@@ -5752,12 +5755,6 @@ package body Sem_Ch8 is
          E := Homonym (E);
       end loop;
 
-      --  If we are ignoring errors, skip the error processing
-
-      if Get_Ignore_Errors then
-         return;
-      end if;
-
       --  If no entries on homonym chain that were potentially visible,
       --  and no entities reasonably considered as non-visible, then
       --  we have a plain undefined reference, with no additional