diff mbox series

[Ada] Fix small inconsistency in new predicate

Message ID 2919666.xOKDoM2nKj@fomalhaut
State New
Headers show
Series [Ada] Fix small inconsistency in new predicate | expand

Commit Message

Eric Botcazou Sept. 12, 2020, 10:48 a.m. UTC
This can result on the mainline in a segfault when an object declared at 
library level is used in the declaration of another, local object.

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


2020-09-12  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (lvalue_for_aggr_p) <N_Object_Declaration>:
	Return false unconditionally.
diff mbox series

Patch

diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index aa4393c24b7..39d4d28fa67 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -968,12 +968,8 @@  lvalue_for_aggregate_p (Node_Id gnat_node, tree gnu_type)
 				     get_unpadded_type (Etype (gnat_parent)));
 
     case N_Object_Declaration:
-      /* For an aggregate object declaration, return the constant at top level
-	 in order to avoid generating elaboration code.  */
-      if (global_bindings_p ())
-	return false;
-
-      /* ... fall through ... */
+      /* For an aggregate object declaration, return false consistently.  */
+      return false;
 
     case N_Assignment_Statement:
       /* For an aggregate assignment, decide based on the size.  */