[committed] C++ front end patch for too large arrays
James E Wilson
wilson@specifix.com
Tue Aug 23 00:14:00 GMT 2005
This partially fixes the problem described in PR 23426. An array larger
than half the address space generates an ICE in tree_int_cst_low. With
this patch, we now get an error. Unfortunately, we get two errors, and
the second one doesn't make any sense, so there is still a problem that
needs to be fixed, but at least we don't get the ICE anymore.
This was tested with an x86_64-linux bootstrap and make check. There
were no regressions. Mark Mitchell OKed the patch in the PR. This is
the same as a patch added to the C front end last week.
I have added the patch to mainline and to the gcc-4.0.x branch. I
needed to backport a small patch by Roger Sayle from mainline for the
gcc-4.0.x branch so it is a slightly different patch.
--
Jim Wilson, GNU Tools Support, http://www.specifix.com
-------------- next part --------------
2005-08-22 James E Wilson <wilson@specifix.com>
PR tree-optimization/23426
* decl.c (grokdeclarator): Use TYPE_SIZE_UNIT not TYPE_SIZE for
array size check.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1418
diff -p -p -r1.1418 decl.c
*** decl.c 15 Aug 2005 20:38:14 -0000 1.1418
--- decl.c 17 Aug 2005 22:43:08 -0000
*************** grokdeclarator (const cp_declarator *dec
*** 7556,7563 ****
if (TREE_CODE (type) == ARRAY_TYPE
&& COMPLETE_TYPE_P (type)
! && TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
! && TREE_OVERFLOW (TYPE_SIZE (type)))
{
error ("size of array %qs is too large", name);
/* If we proceed with the array type as it is, we'll eventually
--- 7556,7563 ----
if (TREE_CODE (type) == ARRAY_TYPE
&& COMPLETE_TYPE_P (type)
! && TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST
! && TREE_OVERFLOW (TYPE_SIZE_UNIT (type)))
{
error ("size of array %qs is too large", name);
/* If we proceed with the array type as it is, we'll eventually
-------------- next part --------------
2005-08-22 James E Wilson <wilson@specifix.com>
PR tree-optimization/23426
* decl.c (grokdeclarator): Use TYPE_SIZE_UNIT not TYPE_SIZE for
array size check.
Backport from mainline
2005-06-14 Roger Sayle <roger@eyesopen.com>
* decl.c (grokdeclarator): Only check TREE_OVERFLOW on INTEGER_CST.
Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1371.2.17
diff -p -p -r1.1371.2.17 decl.c
*** decl.c 10 Aug 2005 00:25:33 -0000 1.1371.2.17
--- decl.c 23 Aug 2005 00:04:21 -0000
*************** grokdeclarator (const cp_declarator *dec
*** 7439,7445 ****
if (TREE_CODE (type) == ARRAY_TYPE
&& COMPLETE_TYPE_P (type)
! && TREE_OVERFLOW (TYPE_SIZE (type)))
{
error ("size of array %qs is too large", name);
/* If we proceed with the array type as it is, we'll eventually
--- 7439,7446 ----
if (TREE_CODE (type) == ARRAY_TYPE
&& COMPLETE_TYPE_P (type)
! && TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST
! && TREE_OVERFLOW (TYPE_SIZE_UNIT (type)))
{
error ("size of array %qs is too large", name);
/* If we proceed with the array type as it is, we'll eventually
More information about the Gcc-patches
mailing list