This patch fixes a bug, where an assignment of the form X(Y).Z := ...
causes the compiler to crash when X does not refer to a visible
declaration.
Tested on x86_64-pc-linux-gnu, committed on trunk
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.
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -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;
------------------
diff --git a/gcc/ada/exp_ch5.adb b/gcc/ada/exp_ch5.adb
--- a/gcc/ada/exp_ch5.adb
+++ b/gcc/ada/exp_ch5.adb
@@ -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)
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -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