public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Fix crash with -gnatdJ and JSON output
@ 2024-05-14  8:23 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2024-05-14  8:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ronan Desplanques

From: Ronan Desplanques <desplanques@adacore.com>

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.

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

---
 gcc/ada/restrict.adb | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gcc/ada/restrict.adb b/gcc/ada/restrict.adb
index 1cc75bec326..bda35d8f441 100644
--- a/gcc/ada/restrict.adb
+++ b/gcc/ada/restrict.adb
@@ -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;
 
-- 
2.43.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-14  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-14  8:23 [COMMITTED] ada: Fix crash with -gnatdJ and JSON output Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).