g++-2.96: ICE
Mark Mitchell
mark@codesourcery.com
Thu Sep 30 19:57:00 GMT 1999
#include <ctype.h>
bool f( char c )
{
return tolower( c );
}
Thanks; fixed with the attached patch. Basically, we were working too
hard; now that we are function-at-a-time we can not do as much work.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
1999-09-20 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (finish_stmt_expr): Change prototype.
* expr.c (cplus_expand_expr): Adjust call accordingly.
* init.c (finish_init_stmts): Likewise.
* parse.y (primary): Likewise.
* pt.c (tsubst_copy): Likewise.
* semantics.c (finish_stmt_expr): Don't take two parameters.
Don't remove generated BLOCKs from the block-tree.
Index: testsuite/g++.old-deja/g++.other/stmtexpr1.C
===================================================================
RCS file: stmtexpr1.C
diff -N stmtexpr1.C
*** /dev/null Sat Dec 5 20:30:03 1998
--- stmtexpr1.C Mon Sep 20 14:17:54 1999
***************
*** 0 ****
--- 1,10 ----
+ // Build don't link:
+ // Special g++ Options: -O
+ // Origin: Thomas Kunert <kunert@physik.tu-dresden.de>
+
+ #include <ctype.h>
+
+ bool f( char c )
+ {
+ return tolower( c );
+ }
Index: cp/cp-tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.310
diff -c -p -r1.310 cp-tree.h
*** cp-tree.h 1999/09/20 20:19:00 1.310
--- cp-tree.h 1999/09/20 21:17:57
*************** extern void finish_label_decl
*** 3674,3680 ****
extern void finish_subobject PROTO((tree));
extern tree finish_parenthesized_expr PROTO((tree));
extern tree begin_stmt_expr PROTO((void));
! extern tree finish_stmt_expr PROTO((tree, tree));
extern tree finish_call_expr PROTO((tree, tree, int));
extern tree finish_increment_expr PROTO((tree, enum tree_code));
extern tree finish_this_expr PROTO((void));
--- 3674,3680 ----
extern void finish_subobject PROTO((tree));
extern tree finish_parenthesized_expr PROTO((tree));
extern tree begin_stmt_expr PROTO((void));
! extern tree finish_stmt_expr PROTO((tree));
extern tree finish_call_expr PROTO((tree, tree, int));
extern tree finish_increment_expr PROTO((tree, enum tree_code));
extern tree finish_this_expr PROTO((void));
Index: cp/expr.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/expr.c,v
retrieving revision 1.30
diff -c -p -r1.30 expr.c
*** expr.c 1999/09/18 01:22:55 1.30
--- expr.c 1999/09/20 21:17:57
*************** cplus_expand_expr (exp, target, tmode, m
*** 245,252 ****
case STMT_EXPR:
{
tree rtl_expr = begin_stmt_expr ();
! tree block = expand_stmt (STMT_EXPR_STMT (exp));
! finish_stmt_expr (rtl_expr, block);
return expand_expr (rtl_expr, target, tmode, modifier);
}
break;
--- 245,252 ----
case STMT_EXPR:
{
tree rtl_expr = begin_stmt_expr ();
! expand_stmt (STMT_EXPR_STMT (exp));
! finish_stmt_expr (rtl_expr);
return expand_expr (rtl_expr, target, tmode, modifier);
}
break;
Index: cp/init.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/init.c,v
retrieving revision 1.137
diff -c -p -r1.137 init.c
*** init.c 1999/09/20 20:19:02 1.137
--- init.c 1999/09/20 21:17:59
*************** finish_init_stmts (stmt_expr, compound_s
*** 990,999 ****
tree compound_stmt;
{
pop_momentary ();
! stmt_expr
! = finish_stmt_expr (stmt_expr,
! finish_compound_stmt (/*has_no_scope=*/1,
! compound_stmt));
/* To avoid spurious warnings about unused values, we set
TREE_USED. */
--- 990,997 ----
tree compound_stmt;
{
pop_momentary ();
! finish_compound_stmt (/*has_no_scope=*/1, compound_stmt);
! stmt_expr = finish_stmt_expr (stmt_expr);
/* To avoid spurious warnings about unused values, we set
TREE_USED. */
Index: cp/parse.y
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/parse.y,v
retrieving revision 1.148
diff -c -p -r1.148 parse.y
*** parse.y 1999/09/20 16:19:26 1.148
--- parse.y 1999/09/20 21:18:07
*************** primary:
*** 1446,1452 ****
$<ttype>$ = begin_stmt_expr ();
}
compstmt ')'
! { $$ = finish_stmt_expr ($<ttype>2, $3); }
/* Koenig lookup support
We could store lastiddecl in $1 to avoid another lookup,
but that would result in many additional reduce/reduce conflicts. */
--- 1446,1452 ----
$<ttype>$ = begin_stmt_expr ();
}
compstmt ')'
! { $$ = finish_stmt_expr ($<ttype>2); }
/* Koenig lookup support
We could store lastiddecl in $1 to avoid another lookup,
but that would result in many additional reduce/reduce conflicts. */
Index: cp/pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.363
diff -c -p -r1.363 pt.c
*** pt.c 1999/09/20 20:19:02 1.363
--- pt.c 1999/09/20 21:18:13
*************** tsubst_copy (t, args, complain, in_decl)
*** 7085,7093 ****
if (!processing_template_decl)
{
tree rtl_expr = begin_stmt_expr ();
! tree block = tsubst_expr (STMT_EXPR_STMT (t), args,
! complain, in_decl);
! return finish_stmt_expr (rtl_expr, block);
}
return t;
--- 7085,7093 ----
if (!processing_template_decl)
{
tree rtl_expr = begin_stmt_expr ();
! tsubst_expr (STMT_EXPR_STMT (t), args,
! complain, in_decl);
! return finish_stmt_expr (rtl_expr);
}
return t;
Index: cp/semantics.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/semantics.c,v
retrieving revision 1.86
diff -c -p -r1.86 semantics.c
*** semantics.c 1999/09/20 20:19:03 1.86
--- semantics.c 1999/09/20 21:18:14
*************** begin_stmt_expr ()
*** 1308,1316 ****
statement-expression. */
tree
! finish_stmt_expr (rtl_expr, expr)
tree rtl_expr;
- tree expr;
{
tree result;
--- 1308,1315 ----
statement-expression. */
tree
! finish_stmt_expr (rtl_expr)
tree rtl_expr;
{
tree result;
*************** finish_stmt_expr (rtl_expr, expr)
*** 1335,1354 ****
last_tree = rtl_expr;
TREE_CHAIN (last_tree) = NULL_TREE;
}
- else if (expr && TREE_CODE (expr) == BLOCK)
- {
- result = build (BIND_EXPR, TREE_TYPE (rtl_expr),
- NULL_TREE, rtl_expr, expr);
- delete_block (expr);
- }
else
result = rtl_expr;
-
- if (expr && TREE_CODE (expr) == BLOCK)
- /* Remove the block from the tree at this point. It gets put back
- at the proper place when the STMT_EXPR or BIND_EXPR is
- expanded. */
- delete_block (expr);
return result;
}
--- 1334,1341 ----
More information about the Gcc-bugs
mailing list