]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix crash with -gnatdJ and JSON output
authorRonan Desplanques <desplanques@adacore.com>
Tue, 13 Feb 2024 11:46:36 +0000 (12:46 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 14 May 2024 08:19:56 +0000 (10:19 +0200)
This patch tweaks the calls made to Errout subprograms to report
violations of dependence restrictions, in order fix a crash that
occurred with -gnatdJ and -fdiagnostics-format=json.

gcc/ada/

* restrict.adb (Violation_Of_No_Dependence): Tweak error
reporting calls.

gcc/ada/restrict.adb

index 1cc75bec3263c8105781c1ead153d8a44f76a4ab..bda35d8f441aac82909b5f861098029a1469c5f9 100644 (file)
@@ -1704,16 +1704,16 @@ package body Restrict is
    --------------------------------
 
    procedure Violation_Of_No_Dependence (Unit : Int; N : Node_Id) is
+      Unit_Node : constant Node_Id := No_Dependences.Table (Unit).Unit;
    begin
-      Error_Msg_Node_1 := No_Dependences.Table (Unit).Unit;
-      Error_Msg_Sloc   := Sloc (Error_Msg_Node_1);
+      Error_Msg_Sloc := Sloc (Unit_Node);
 
       if No_Dependences.Table (Unit).Warn then
-         Error_Msg
-           ("?*?violation of restriction `No_Dependence '='> &`#", Sloc (N));
+         Error_Msg_NE ("?*?violation of restriction `No_Dependence '='> &`#",
+           N, Unit_Node);
       else
-         Error_Msg
-           ("|violation of restriction `No_Dependence '='> &`#", Sloc (N));
+         Error_Msg_NE ("|violation of restriction `No_Dependence '='> &`#", N,
+           Unit_Node);
       end if;
    end Violation_Of_No_Dependence;