diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-25 13:27:32 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-10-25 13:27:32 +0000 |
commit | 4b592242c998f8b5ed827945c0d504cd7e88bd18 (patch) | |
tree | 3ea37435d5af3d291b57b64a93db96a445576a2b /gcc | |
parent | 6d02c623a56249660cbdffe6a1d1b97246a0fa0a (diff) | |
download | ppe42-gcc-4b592242c998f8b5ed827945c0d504cd7e88bd18.tar.gz ppe42-gcc-4b592242c998f8b5ed827945c0d504cd7e88bd18.zip |
2004-10-25 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/17407
* c-decl.c (grokdeclarator) <case cdk_array>: Remove the call
layout_type as it is already done by build_array_type.
* tree.c (build_array_type): Layout the type even
2004-10-25 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/18121
* decl.c (grokdeclarator) <case cdk_array>: Remove the call
layout_type as it is already done by create_array_type_for_decl.
2004-10-25 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/17407
* gcc.c-torture/compile/pr17407.c: New test.
PR c++/18121
* g++.dg/template/array8.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89533 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-decl.c | 5 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/array8.C | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr17407.c | 15 | ||||
-rw-r--r-- | gcc/tree.c | 7 |
8 files changed, 57 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 039be86bbc4..16777c9341c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2004-10-25 Andrew Pinski <pinskia@physics.uc.edu> + + PR middle-end/17407 + * c-decl.c (grokdeclarator) <case cdk_array>: Remove the call + layout_type as it is already done by build_array_type. + * tree.c (build_array_type): Layout the type even + 2004-10-25 Alexandre Oliva <aoliva@redhat.com> * config/frv/linux.h (TARGET_C99_FUNCTIONS): Define to 0. diff --git a/gcc/c-decl.c b/gcc/c-decl.c index a2443ec6c19..08f79098243 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -4133,14 +4133,9 @@ grokdeclarator (const struct c_declarator *declarator, zero. */ if (size && integer_zerop (size)) { - layout_type (type); TYPE_SIZE (type) = bitsize_zero_node; TYPE_SIZE_UNIT (type) = size_zero_node; } - else if (declarator->kind == cdk_pointer) - /* We can never complete an array type which is the - target of a pointer, so go ahead and lay it out. */ - layout_type (type); if (decl_context != PARM && (array_ptr_quals != TYPE_UNQUALIFIED diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b5dae4983e1..8e759ff5f91 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-10-25 Andrew Pinski <pinskia@physics.uc.edu> + + PR c++/18121 + * decl.c (grokdeclarator) <case cdk_array>: Remove the call + layout_type as it is already done by create_array_type_for_decl. + 2004-10-22 Nathan Sidwell <nathan@codesourcery.com> PR c++/18095 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 21ffb519e82..2aca629cfe4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7214,13 +7214,6 @@ grokdeclarator (const cp_declarator *declarator, case cdk_array: type = create_array_type_for_decl (dname, type, declarator->u.array.bounds); - if (inner_declarator - && (inner_declarator->kind == cdk_pointer - || inner_declarator->kind == cdk_reference - || inner_declarator->kind == cdk_ptrmem)) - /* We can never complete an array type which is the - target of a pointer, so go ahead and lay it out. */ - layout_type (type); break; case cdk_function: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f6de047b011..765daa2758f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2004-10-25 Andrew Pinski <pinskia@physics.uc.edu> + + PR middle-end/17407 + * gcc.c-torture/compile/pr17407.c: New test. + + PR c++/18121 + * g++.dg/template/array8.C: New test. + 2004-10-25 Eric Botcazou <ebotcazou@libertysurf.fr> PR other/18138 diff --git a/gcc/testsuite/g++.dg/template/array8.C b/gcc/testsuite/g++.dg/template/array8.C new file mode 100644 index 00000000000..9fd33a4aa7d --- /dev/null +++ b/gcc/testsuite/g++.dg/template/array8.C @@ -0,0 +1,16 @@ +// PR c++/18121 + +// We were trying to layout the array +// type but since the type/value of A<N>::i +// was not known at template declation type, +// we were crashing + +template<int> struct A +{ + static int const i = 1; +}; + +template<int N> struct B +{ + typedef int (*p)[A<N>::i]; +}; diff --git a/gcc/testsuite/gcc.c-torture/compile/pr17407.c b/gcc/testsuite/gcc.c-torture/compile/pr17407.c new file mode 100644 index 00000000000..a06ab17580e --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr17407.c @@ -0,0 +1,15 @@ +typedef struct libxml_xpathCallback { + void *ns_uri; +} libxml_xpathCallback; + +typedef libxml_xpathCallback libxml_xpathCallbackArray[]; + +libxml_xpathCallbackArray *libxml_xpathCallbacks; + +void foo1(void); + +void +foo (void) +{ + if ((*libxml_xpathCallbacks)[3].ns_uri != ((void *)0)) foo1(); +} diff --git a/gcc/tree.c b/gcc/tree.c index b132571b5f3..18dec5ea730 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4333,9 +4333,12 @@ build_array_type (tree elt_type, tree index_type) t = make_node (ARRAY_TYPE); TREE_TYPE (t) = elt_type; TYPE_DOMAIN (t) = index_type; - + if (index_type == 0) - return t; + { + layout_type (t); + return t; + } hashcode = iterative_hash_object (TYPE_HASH (elt_type), hashcode); hashcode = iterative_hash_object (TYPE_HASH (index_type), hashcode); |