]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/c-typeck.c
re PR c/12913 (Jumps into variable length array scope not rejected)
authorJoseph Myers <joseph@codesourcery.com>
Wed, 20 Apr 2005 16:41:48 +0000 (17:41 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Wed, 20 Apr 2005 16:41:48 +0000 (17:41 +0100)
commit187230a795716fc0d98cb066402fe9d71639996c
treee2e44d98a3c2439eda0265c0bce9ef5990fc410d
parent2a9254314b416c9d6e8eccf600a54ed829a48147
re PR c/12913 (Jumps into variable length array scope not rejected)

PR c/12913
* c-tree.h (struct c_label_list): Update comment.
(struct c_label_context): Rename to struct c_label_context_se.
(label_context_stack): Rename to label_context_stack_se.
(C_DECL_UNJUMPABLE_VM, C_DECL_UNDEFINABLE_VM, struct
c_label_context_vm, label_context_stack_vm, c_begin_vm_scope,
c_end_vm_scope): New.
(C_DECL_DECLARED_BUILTIN, C_DECL_USED): Use FUNCTION_DECL_CHECK.
* c-decl.c (pop_scope): Call c_end_vm_scope.
(pushdecl): Call c_begin_vm_scope for variably modified
declarations.
(define_label): Check for jumping into scope of identifier with
variably modified type.  Push label on stack for those defined at
current context of identifiers with variably modified type.
(start_function): Create stack level for context of identifiers
with variably modified type.
(finish_function): Pop stack level for context of identifiers with
variably modified type.
* c-typeck.c (label_context_stack): Rename to
label_context_stack_se.
(label_context_stack_vm, c_begin_vm_scope, c_end_vm_scope): New.
(c_finish_goto_label): Check for jumping into scope of identifier
with variably modified type.  Push label on stack for those jumped
to from current context of identifiers with variably modified
type.
(struct c_switch): Add blocked_vm.
(c_start_case): Initialize blocked_vm.
(do_case): Check blocked_vm.
(c_finish_case): Add comment.
(c_begin_stmt_expr, c_finish_stmt_expr): Update for renamed
variable label_context_stack.

objc:
* objc-act.c (objc_start_function): Create stack level for context
of identifiers with variably modified type.

testsuite:
* gcc.dg/c99-vla-jump-1.c, gcc.dg/c99-vla-jump-2.c,
gcc.dg/c99-vla-jump-3.c, gcc.dg/c99-vla-jump-4.c,
gcc.dg/c99-vla-jump-5.c: New tests.

From-SVN: r98464
12 files changed:
gcc/ChangeLog
gcc/c-decl.c
gcc/c-tree.h
gcc/c-typeck.c
gcc/objc/ChangeLog
gcc/objc/objc-act.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/c99-vla-jump-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-vla-jump-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-vla-jump-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-vla-jump-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c99-vla-jump-5.c [new file with mode: 0644]