diff mbox

[Ada] Internal error on renaming of constant array with -gnatc

Message ID 1524495.xhjpCim1za@polaris
State New
Headers show

Commit Message

Eric Botcazou Nov. 18, 2013, 9:48 a.m. UTC
This fixes an ICE on an obscure case with the -gnatc switch.

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


2013-11-18  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Deal with an
	error mark as renamed object in type annotating mode.
diff mbox

Patch

Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 204913)
+++ gcc-interface/decl.c	(working copy)
@@ -1117,8 +1117,12 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
 			   as we have a VAR_DECL for the pointer we make.  */
 		      }
 
-		    gnu_expr = build_unary_op (ADDR_EXPR, gnu_type,
-					       maybe_stable_expr);
+		    if (type_annotate_only
+ 			&& TREE_CODE (maybe_stable_expr) == ERROR_MARK)
+		      gnu_expr = NULL_TREE;
+		    else
+		      gnu_expr = build_unary_op (ADDR_EXPR, gnu_type,
+						 maybe_stable_expr);
 
 		    gnu_size = NULL_TREE;
 		    used_by_ref = true;