diff options
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 039be86..16777c9 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 a2443ec..08f7909 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 b5dae49..8e759ff 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 21ffb51..2aca629 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 f6de047..765daa2 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 0000000..9fd33a4 --- /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 0000000..a06ab17 --- /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(); +} @@ -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); |