OSDN Git Service

PR c/772
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 Mar 2005 19:56:39 +0000 (19:56 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 30 Mar 2005 19:56:39 +0000 (19:56 +0000)
commitf08c7a57f79b981e68df4f7d1cfa244297849c4a
tree975e92e4bf871faf584ef0740e176cafc5997392
parent494fc9d0f43f28049e7334c2f16183a700da3882
PR c/772
PR c/17913
* c-tree.h (C_DECL_UNJUMPABLE_STMT_EXPR,
C_DECL_UNDEFINABLE_STMT_EXPR, struct c_label_list, struct
c_label_context, label_context_stack): New.
* c-decl.c (define_label): Check for jumps into statement
expressions.  Add label to list of defined labels.
(start_function): Push context on label_context_stack.
(finish_function): Pop context from label_context_stack.
* c-typeck.c (label_context_stack): New.
(c_finish_goto_label): Check for jumps into statement
expressions.  Add label to list of jumped to labels.
(struct c_switch): Add blocked_stmt_expr.
(c_start_case): Initialize it.
(do_case): Check it.
(c_finish_case): Verify !blocked_stmt_expr.
(c_begin_stmt_expr):  Push context on label_context_stack.
Increment blocked_stmt_expr.  Mark labels jumped to from outside
as undefinable.
(c_finish_stmt_expr): December blocked_stmt_expr.  Mark labels
defined in the statement expression and no longer jumpable to.
Mark labels jumped to from just outside the statement expression
as again definable.  Pop context from label_context_stack.
* doc/extend.texi (Statement Exprs): Update.

objc:
* objc-act.c (objc_start_function): Push context on
label_context_stack.

testsuite:
* gcc.dg/stmt-expr-label-1.c, gcc.dg/stmt-expr-label-2.c,
gcc.dg/stmt-expr-label-3.c : New tests.
* gcc.c-torture/execute/medce-2.c: Remove.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97273 138bc75d-0d04-0410-961f-82ee72b054a4
12 files changed:
gcc/ChangeLog
gcc/c-decl.c
gcc/c-tree.h
gcc/c-typeck.c
gcc/doc/extend.texi
gcc/objc/ChangeLog
gcc/objc/objc-act.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/medce-2.c [deleted file]
gcc/testsuite/gcc.dg/stmt-expr-label-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/stmt-expr-label-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/stmt-expr-label-3.c [new file with mode: 0644]