From 2d00b4f20784406dfb07a1260c0646ec3cdda75a Mon Sep 17 00:00:00 2001 From: Andrew Pinski <pinskia@physics.uc.edu> Date: Fri, 28 Oct 2005 14:57:30 +0000 Subject: [PATCH] re PR c++/23426 (Too large array problem gives two error message) 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 | 8 +++++++ gcc/cp/decl.c | 6 ++--- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/g++.dg/other/large-size-array.C | 23 +++++++++++++++++++ 4 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/other/large-size-array.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dee7410600df..d2ec158c9058 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 24318777e317..ef61d1745f15 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7d844ac2105e..bd5ff267abcd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 index 000000000000..900c50331697 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/large-size-array.C @@ -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]); +} + + -- GitLab