From: Eric Botcazou Date: Sun, 11 Dec 2011 11:05:58 +0000 (+0000) Subject: utils2.c (gnat_build_constructor): Test the TREE_STATIC flag of elements to compute... X-Git-Tag: releases/gcc-4.7.0~1633 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cce30ea89cd30aab0b37a0b09ec56a4107fcc773;p=thirdparty%2Fgcc.git utils2.c (gnat_build_constructor): Test the TREE_STATIC flag of elements to compute that of the constructor. * gcc-interface/utils2.c (gnat_build_constructor): Test the TREE_STATIC flag of elements to compute that of the constructor. From-SVN: r182203 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6a2dd2604fa7..6adbc2ab48bd 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2011-12-11 Eric Botcazou + + * gcc-interface/utils2.c (gnat_build_constructor): Test the TREE_STATIC + flag of elements to compute that of the constructor. + 2011-12-11 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_param): Set the restrict qualifier diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index f9e48b79fe5d..93663b489827 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -1817,7 +1817,7 @@ gnat_build_constructor (tree type, VEC(constructor_elt,gc) *v) FOR_EACH_CONSTRUCTOR_ELT (v, n_elmts, obj, val) { /* The predicate must be in keeping with output_constructor. */ - if (!TREE_CONSTANT (val) + if ((!TREE_CONSTANT (val) && !TREE_STATIC (val)) || (TREE_CODE (type) == RECORD_TYPE && CONSTRUCTOR_BITFIELD_P (obj) && !initializer_constant_valid_for_bitfield_p (val)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 41e3b40a6dbf..cfb9a614f190 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-12-11 Eric Botcazou + + * gnat.dg/specs/elab3.ads: New test. + 2011-12-10 Richard Henderson * gcc.target/powerpc/altivec-perm-1.c: New. diff --git a/gcc/testsuite/gnat.dg/specs/elab3.ads b/gcc/testsuite/gnat.dg/specs/elab3.ads new file mode 100644 index 000000000000..7af6f386d1f6 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/elab3.ads @@ -0,0 +1,16 @@ +-- { dg-do compile } + +pragma Restrictions(No_Elaboration_Code); + +package Elab3 is + + type T_List is array (Positive range <>) of Integer; + type T_List_Access is access constant T_List; + + type R is record + A : T_List_Access; + end record; + + C : constant R := (A => null); + +end Elab3;