diff mbox series

[COMMITTED,12/35] ada: Fix crash with -gnatdJ and -gnatw_q

Message ID 20240516092606.41242-12-poulhies@adacore.com
State New
Headers show
Series [COMMITTED,01/35] ada: Fix docs and comments about pragmas for Boolean-valued aspects | expand

Commit Message

Marc Poulhiès May 16, 2024, 9:25 a.m. UTC
From: Ronan Desplanques <desplanques@adacore.com>

This commit makes the emission of -gnatw_q warnings pass node information
so as to handle the enclosing subprogram display of -gnatdJ instead of
crashing.

gcc/ada/

	* exp_ch4.adb (Expand_Composite_Equality): Call Error_Msg_N
	instead of Error_Msg.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_ch4.adb | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 762e75616a7..7a2003691ec 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -2340,12 +2340,12 @@  package body Exp_Ch4 is
                pragma Assert
                  (Is_First_Subtype (Outer_Type)
                    or else Is_Generic_Actual_Type (Outer_Type));
-               Error_Msg_Node_1 := Outer_Type;
                Error_Msg_Node_2 := Comp_Type;
-               Error_Msg
-                 ("?_q?""="" for type & uses predefined ""="" for }", Loc);
+               Error_Msg_N
+                 ("?_q?""="" for type & uses predefined ""="" for }",
+                  Outer_Type);
                Error_Msg_Sloc := Sloc (Op);
-               Error_Msg ("\?_q?""="" # is ignored here", Loc);
+               Error_Msg_N ("\?_q?""="" # is ignored here", Outer_Type);
             end if;
          end;