re PR c++/23426 (Too large array problem gives two error message)
authorAndrew Pinski <pinskia@physics.uc.edu>
Fri, 28 Oct 2005 14:57:30 +0000 (14:57 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 28 Oct 2005 14:57:30 +0000 (07:57 -0700)
2005-10-28  Andrew Pinski  <pinskia@physics.uc.edu>

PR C++/23426
* decl.c (start_decl): Check that the decl is an
error_mark_node before getting the type.
Remove the check for the decl's type being an
error_mark_node.

2005-10-28  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/23426
        * g++.dg/other/large-size-array.C: New test.

From-SVN: r105936

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/large-size-array.C [new file with mode: 0644]

index dee7410600dfbdd78015cf2918446c1f21a803f2..d2ec158c9058c03b5876f4b54ef8f65036b1a5e1 100644 (file)
@@ -1,3 +1,11 @@
+2005-10-28  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR C++/23426
+       * decl.c (start_decl): Check that the decl is an
+       error_mark_node before getting the type.
+       Remove the check for the decl's type being an
+       error_mark_node.  
+
 2005-10-21  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/24260
index 24318777e31782d75af42c93b1a342026e64bf9f..ef61d1745f15e91f97eacc0ea7f00d996128dd08 100644 (file)
@@ -3640,14 +3640,12 @@ start_decl (const cp_declarator *declarator,
 
   deprecated_state = DEPRECATED_NORMAL;
 
-  if (decl == NULL_TREE || TREE_CODE (decl) == VOID_TYPE)
+  if (decl == NULL_TREE || TREE_CODE (decl) == VOID_TYPE
+      || decl == error_mark_node)
     return error_mark_node;
 
   type = TREE_TYPE (decl);
 
-  if (type == error_mark_node)
-    return error_mark_node;
-
   context = DECL_CONTEXT (decl);
 
   if (context)
index 7d844ac2105e745a890fc3faea1667c6232f097f..bd5ff267abcdfc1e1d73817591d9dbf04f207471 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-28  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR C++/23426
+       * g++.dg/other/large-size-array.C: New test.
+
 2005-10-28  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR middle-end/24362
diff --git a/gcc/testsuite/g++.dg/other/large-size-array.C b/gcc/testsuite/g++.dg/other/large-size-array.C
new file mode 100644 (file)
index 0000000..900c503
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+#include <limits.h>
+
+#ifdef __LP64__
+#define DIM UINT_MAX>>1
+#else
+#define DIM USHRT_MAX>>1
+#endif
+
+int
+sub (int *a)
+{
+  return a[0];
+}
+
+int
+main (void)
+{
+  int a[DIM][DIM];  /* { dg-error "size of array 'a' is too large" } */
+  return sub (&a[0][0]);
+}
+
+