This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH]: Fix 13494
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Mark Mitchell <mitchell at codesourcery dot com>
- Date: Tue, 30 Dec 2003 10:07:03 +0000
- Subject: [C++ PATCH]: Fix 13494
- Organization: Codesourcery LLC
Hi,
I've installed this patch to fix 13494. It is another case of not properly
folding array domains on ABI-1. Fortunately build_array_type has a call to
fold at just the right point for this to be the correct patch.
booted & tested on i686-pc-linux-gnu with ABI's 1 and 2
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2003-12-30 Nathan Sidwell <nathan@codesourcery.com>
PR c++/13494
* tree.c (build_cplus_array_type_1): Only build a minimal array
type for dependent types or domains.
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.359
diff -c -3 -p -r1.359 tree.c
*** cp/tree.c 22 Dec 2003 20:42:57 -0000 1.359
--- cp/tree.c 29 Dec 2003 18:20:34 -0000
*************** build_cplus_array_type_1 (tree elt_type,
*** 363,376 ****
if (elt_type == error_mark_node || index_type == error_mark_node)
return error_mark_node;
! /* Don't do the minimal thing just because processing_template_decl is
! set; we want to give string constants the right type immediately, so
! we don't have to fix them up at instantiation time. */
! if ((processing_template_decl
! && index_type && TYPE_MAX_VALUE (index_type)
! && TREE_CODE (TYPE_MAX_VALUE (index_type)) != INTEGER_CST)
! || uses_template_parms (elt_type)
! || (index_type && uses_template_parms (index_type)))
{
t = make_node (ARRAY_TYPE);
TREE_TYPE (t) = elt_type;
--- 363,371 ----
if (elt_type == error_mark_node || index_type == error_mark_node)
return error_mark_node;
! if (dependent_type_p (elt_type)
! || (index_type
! && value_dependent_expression_p (TYPE_MAX_VALUE (index_type))))
{
t = make_node (ARRAY_TYPE);
TREE_TYPE (t) = elt_type;
// { dg-do compile }
// { dg-options "-fabi-version=1" }
// Copyright (C) 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Dec 2003 <nathan@codesourcery.com>
// PR c++/13494. ICE
template<typename T>
int foo(int d[][4])
{
return d[0][0];
}
// { dg-do compile }
// { dg-options "-fabi-version=2" }
// Copyright (C) 2003 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 29 Dec 2003 <nathan@codesourcery.com>
// PR c++/13494. ICE
template<typename T>
int foo(int d[][4])
{
return d[0][0];
}