summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-31 02:15:45 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-31 02:15:45 +0000
commitc47c77bb058d7b196330aafc7b2d6fac41ef027d (patch)
tree704bec3269c5aecdf4f58a146dcaa2e30e30c502
parentf9a54cc52781fb914d52b90dc67ac071b11b3b5c (diff)
downloadppe42-gcc-c47c77bb058d7b196330aafc7b2d6fac41ef027d.tar.gz
ppe42-gcc-c47c77bb058d7b196330aafc7b2d6fac41ef027d.zip
* error.c (dump_type_suffix): Avoid use of cp_build_binary_op when
calculating the size of an array (to avoid recursive errors). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@121371 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/error.c18
2 files changed, 14 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ad008bf1aa7..c89e3836055 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2007-01-30 Roger Sayle <roger@eyesopen.com>
+
+ * error.c (dump_type_suffix): Avoid use of cp_build_binary_op when
+ calculating the size of an array (to avoid recursive errors).
+
2007-01-30 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c++/24745
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 49f3367d743..00f07677454 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -1,7 +1,7 @@
/* Call-backs for C++ error reporting.
This code is non-reentrant.
Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
@@ -629,16 +629,16 @@ dump_type_suffix (tree t, int flags)
pp_cxx_left_bracket (cxx_pp);
if (TYPE_DOMAIN (t))
{
- if (host_integerp (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0))
- pp_wide_integer
- (cxx_pp, tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0) + 1);
- else if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (t))) == MINUS_EXPR)
- dump_expr (TREE_OPERAND (TYPE_MAX_VALUE (TYPE_DOMAIN (t)), 0),
+ tree dtype = TYPE_DOMAIN (t);
+ tree max = TYPE_MAX_VALUE (dtype);
+ if (host_integerp (max, 0))
+ pp_wide_integer (cxx_pp, tree_low_cst (max, 0) + 1);
+ else if (TREE_CODE (max) == MINUS_EXPR)
+ dump_expr (TREE_OPERAND (max, 0),
flags & ~TFF_EXPR_IN_PARENS);
else
- dump_expr (fold (cp_build_binary_op
- (PLUS_EXPR, TYPE_MAX_VALUE (TYPE_DOMAIN (t)),
- integer_one_node)),
+ dump_expr (fold_build2 (PLUS_EXPR, dtype, max,
+ build_int_cst (dtype, 1)),
flags & ~TFF_EXPR_IN_PARENS);
}
pp_cxx_right_bracket (cxx_pp);
OpenPOWER on IntegriCloud