aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2004-10-25 13:27:32 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2004-10-25 06:27:32 -0700
commit4c7c0c70e3aecf557e968d3d0941e21f1f875f83 (patch)
tree3ea37435d5af3d291b57b64a93db96a445576a2b
parentd87bdb13309e3f691fe0570c16cdcbdb6991d55b (diff)
downloadgcc-4c7c0c70e3aecf557e968d3d0941e21f1f875f83.zip
gcc-4c7c0c70e3aecf557e968d3d0941e21f1f875f83.tar.gz
gcc-4c7c0c70e3aecf557e968d3d0941e21f1f875f83.tar.bz2
re PR middle-end/17407 (ICE in int_mode_for_mode)
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. From-SVN: r89533
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/c-decl.c5
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/g++.dg/template/array8.C16
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr17407.c15
-rw-r--r--gcc/tree.c7
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();
+}
diff --git a/gcc/tree.c b/gcc/tree.c
index b132571..18dec5e 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);