From: jakub Date: Tue, 17 May 2005 06:51:48 +0000 (+0000) Subject: PR c++/21454 X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=76828b12a6e1260772f9acddeda5bbfdb954d503;p=pf3gnuchains%2Fgcc-fork.git PR c++/21454 * decl.c (maybe_deduce_size_from_array_init): Call cp_apply_type_quals_to_decl after completing array type. * g++.dg/opt/const4.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99817 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0a21f0a1979..d5a88e9d2db 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-05-17 Jakub Jelinek + + PR c++/21454 + * decl.c (maybe_deduce_size_from_array_init): Call + cp_apply_type_quals_to_decl after completing array type. + 2005-05-16 Richard Henderson * decl.c (build_library_fn_1): Move setting TREE_NOTHROW ... diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c110d9fc5ff..ac7608b76c3 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3939,6 +3939,8 @@ maybe_deduce_size_from_array_init (tree decl, tree init) if (failure == 3) error ("zero-size array %qD", decl); + cp_apply_type_quals_to_decl (cp_type_quals (TREE_TYPE (decl)), decl); + layout_decl (decl, 0); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2428cf14f36..367947b929b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2005-05-17 Jakub Jelinek + PR c++/21454 + * g++.dg/opt/const4.C: New test. + PR middle-end/21492 * g++.dg/opt/crossjump1.C: New test. diff --git a/gcc/testsuite/g++.dg/opt/const4.C b/gcc/testsuite/g++.dg/opt/const4.C new file mode 100644 index 00000000000..883c24b55fc --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/const4.C @@ -0,0 +1,9 @@ +// PR c++/21454 +// Test whether A is put into .rodata section on platforms +// that have it. +// { dg-do compile } + +const int a[] __attribute__ ((__used__)) = { 0, 1, 2, 3 }; + +// The MMIX port always switches to the .data section at the end of a file. +// { dg-final { scan-assembler-not "\\.data(?!\\.rel\\.ro)" { xfail powerpc*-*-aix* mmix-*-* } } }