[Ada] Default to no source locations in non-GCC backend bug boxes

Pierre-Marie de Rodat derodat@adacore.com
Mon Sep 25 09:26:00 GMT 2017


Default to "No source file position information available" message for
bug boxes emitted from the non-GCC backends. No test provided, because
this only affects bug boxes.

Tested on x86_64-pc-linux-gnu, committed on trunk

2017-09-25  Piotr Trojanek  <trojanek@adacore.com>

	* adabkend.adb (Call_Back_End): Reset Current_Error_Node when starting
	the backend.

-------------- next part --------------
Index: adabkend.adb
===================================================================
--- adabkend.adb	(revision 253134)
+++ adabkend.adb	(working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                     Copyright (C) 2001-2016, AdaCore                     --
+--                     Copyright (C) 2001-2017, AdaCore                     --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -22,6 +22,7 @@
 
 --  This is the version of the Back_End package for back ends written in Ada
 
+with Atree;    use Atree;
 with Debug;
 with Lib;
 with Opt;      use Opt;
@@ -56,6 +57,13 @@
          Write_Eol;
       end if;
 
+      --  Frontend leaves the Current_Error_Node at a location that is
+      --  meaningless and confusing when emitting bugboxes from the backed. By
+      --  resetting it here we default to "No source file position information
+      --  available" message on backend crashes.
+
+      Current_Error_Node := Empty;
+
       Driver (Lib.Cunit (Types.Main_Unit));
    end Call_Back_End;
 


More information about the Gcc-patches mailing list