aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2002-02-08 08:51:19 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2002-02-08 08:51:19 +0100
commit1cf537c53e28cae8f35fb516847f7361e3098c64 (patch)
tree3b6d2649163ab940f0abbf0bd184ff1bb3ee5c17 /gcc/c-common.c
parent8f94053d3274ffe6cddba040ed6e42a350df22b8 (diff)
downloadgcc-1cf537c53e28cae8f35fb516847f7361e3098c64.zip
gcc-1cf537c53e28cae8f35fb516847f7361e3098c64.tar.gz
gcc-1cf537c53e28cae8f35fb516847f7361e3098c64.tar.bz2
c-common.c (c_expand_expr): Revert 2002-02-06 patch.
* c-common.c (c_expand_expr): Revert 2002-02-06 patch. * c-parse.in (compstmt): Clear last_expr_type. * parse.y (primary, primary_no_id): Use compstmt_or_stmtexpr instead of compstmt. (compstmt_or_stmtexpr): Renamed from compstmt. (compstmt): In addition to compstmt_or_stmtexpr clear last_expr_type. * gcc.c-torture/execute/20020206-1.c: Test whether nesting 2 expression statements work instead. * gcc.dg/noncompile/20020207-1.c: New test. From-SVN: r49609
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 4b7946b..6b986d8 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -3466,32 +3466,22 @@ c_expand_expr (exp, target, tmode, modifier)
/* If we want the result of this expression, find the last
EXPR_STMT in the COMPOUND_STMT and mark it as addressable. */
- if (target != const0_rtx)
+ if (target != const0_rtx
+ && TREE_CODE (STMT_EXPR_STMT (exp)) == COMPOUND_STMT
+ && TREE_CODE (COMPOUND_BODY (STMT_EXPR_STMT (exp))) == SCOPE_STMT)
{
- tree expr = STMT_EXPR_STMT (exp);
- tree last;
+ tree expr = COMPOUND_BODY (STMT_EXPR_STMT (exp));
+ tree last = TREE_CHAIN (expr);
- while (TREE_CODE (expr) == COMPOUND_STMT
- && TREE_CODE (COMPOUND_BODY (expr)) == SCOPE_STMT)
+ while (TREE_CHAIN (last))
{
- expr = COMPOUND_BODY (expr);
- last = TREE_CHAIN (expr);
-
- while (TREE_CHAIN (last))
- {
- expr = last;
- last = TREE_CHAIN (last);
- }
-
- if (TREE_CODE (last) != SCOPE_STMT)
- abort ();
-
- if (TREE_CODE (expr) == EXPR_STMT)
- {
- TREE_ADDRESSABLE (expr) = 1;
- break;
- }
+ expr = last;
+ last = TREE_CHAIN (last);
}
+
+ if (TREE_CODE (last) == SCOPE_STMT
+ && TREE_CODE (expr) == EXPR_STMT)
+ TREE_ADDRESSABLE (expr) = 1;
}
expand_stmt (STMT_EXPR_STMT (exp));