[Ada] Make sure subprogram locus is initialized

Message ID 1723612.iInQtfIT1g@polaris
State New
Headers show
  • [Ada] Make sure subprogram locus is initialized
Related show

Commit Message

Eric Botcazou Dec. 13, 2017, 9:30 a.m.
This is another fixlet aimed at making gigi more robust in the presence of 
unexpected nodes in the expanded code.

Tested on x86_64-suse-linux, applied on the mainline and 7 branch.

2017-12-13  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (Subprogram_Body_to_gnu): Initialize locus.

Eric Botcazou


Index: gcc-interface/trans.c
--- gcc-interface/trans.c	(revision 255601)
+++ gcc-interface/trans.c	(working copy)
@@ -3773,7 +3773,8 @@  Subprogram_Body_to_gnu (Node_Id gnat_nod
   /* Set the line number in the decl to correspond to that of the body.  */
-  Sloc_to_locus (Sloc (gnat_node), &locus);
+  if (!Sloc_to_locus (Sloc (gnat_node), &locus))
+    locus = input_location;
   DECL_SOURCE_LOCATION (gnu_subprog_decl) = locus;
   /* If the body comes from an expression function, arrange it to be inlined