Patchwork [Ada] Fix ICE with -gnatVa -g on UC to Float

login
register
mail settings
Submitter Eric Botcazou
Date Nov. 10, 2010, 11:34 a.m.
Message ID <201011101234.45071.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/70623/
State New
Headers show

Comments

Eric Botcazou - Nov. 10, 2010, 11:34 a.m.
This is a regression present on the mainline: the compiler aborts when trying 
to generate debug info for a temporary initialized to an unchecked conversion 
from record type for Float.  Fixed by not generating debug info in this case.

Tested on i586-suse-linux, applied on the mainline.


2010-11-10  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c (gnat_to_gnu_entity): Do not set DECL_ARTIFICIAL
	on the reused DECL node coming from a renamed object.
	Set DECL_IGNORED_P on the DECL node built for renaming entities if they
	don't need debug info.


2010-11-10  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/unchecked_convert7.adb: New test.

Patch

Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 166490)
+++ gcc-interface/decl.c	(working copy)
@@ -4894,13 +4894,17 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
 	Set_RM_Size (gnat_entity, annotate_value (rm_size (gnu_type)));
     }
 
-  if (!Comes_From_Source (gnat_entity) && DECL_P (gnu_decl))
-    DECL_ARTIFICIAL (gnu_decl) = 1;
+  /* If we really have a ..._DECL node, set a couple of flags on it.  But we
+     cannot do that if we are reusing the ..._DECL node made for a renamed
+     object, since the predicates don't apply to it but to GNAT_ENTITY.  */
+  if (DECL_P (gnu_decl) && !(Present (Renamed_Object (gnat_entity)) && saved))
+    {
+      if (!Comes_From_Source (gnat_entity))
+	DECL_ARTIFICIAL (gnu_decl) = 1;
 
-  if (!debug_info_p && DECL_P (gnu_decl)
-      && TREE_CODE (gnu_decl) != FUNCTION_DECL
-      && No (Renamed_Object (gnat_entity)))
-    DECL_IGNORED_P (gnu_decl) = 1;
+      if (!debug_info_p && TREE_CODE (gnu_decl) != FUNCTION_DECL)
+	DECL_IGNORED_P (gnu_decl) = 1;
+    }
 
   /* If we haven't already, associate the ..._DECL node that we just made with
      the input GNAT entity node.  */