public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/12913] New: Jumps into variable length array scope not rejected
@ 2003-11-05 17:23 falk at debian dot org
2003-11-08 16:44 ` [Bug c/12913] " pinskia at gcc dot gnu dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: falk at debian dot org @ 2003-11-05 17:23 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12913
Summary: Jumps into variable length array scope not rejected
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: falk at debian dot org
CC: gcc-bugs at gcc dot gnu dot org
gcc does not reject jumps over the declaration of a variable length array:
void f(int l) {
goto label;
int a[l];
label:;
}
void g (int l) {
switch (l) {
case 1:;
int a[l];
default:;
}
}
gcc 3.3 rejects at least the first case with the pretty misleading error message
test.c:4: error: label `label' used before containing binding contour
but mainline accepts both.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/12913] Jumps into variable length array scope not rejected
2003-11-05 17:23 [Bug c/12913] New: Jumps into variable length array scope not rejected falk at debian dot org
@ 2003-11-08 16:44 ` pinskia at gcc dot gnu dot org
2003-11-14 16:33 ` dhazeghi at yahoo dot com
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-08 16:44 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-11-08 16:44 -------
In fact c++ front-end rejects only first one in 3.4 also.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12913
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/12913] Jumps into variable length array scope not rejected
2003-11-05 17:23 [Bug c/12913] New: Jumps into variable length array scope not rejected falk at debian dot org
2003-11-08 16:44 ` [Bug c/12913] " pinskia at gcc dot gnu dot org
@ 2003-11-14 16:33 ` dhazeghi at yahoo dot com
2003-11-15 16:12 ` falk at debian dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-11-14 16:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From dhazeghi at yahoo dot com 2003-11-14 16:33 -------
Mainline (20031107) has the same error message you got in 3.3. I certainly didn't find the
message helpful though. Does mainline still accept this for you?
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Keywords|accepts-invalid |diagnostic
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12913
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/12913] Jumps into variable length array scope not rejected
2003-11-05 17:23 [Bug c/12913] New: Jumps into variable length array scope not rejected falk at debian dot org
2003-11-08 16:44 ` [Bug c/12913] " pinskia at gcc dot gnu dot org
2003-11-14 16:33 ` dhazeghi at yahoo dot com
@ 2003-11-15 16:12 ` falk at debian dot org
2003-11-15 16:15 ` falk at debian dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: falk at debian dot org @ 2003-11-15 16:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From falk at debian dot org 2003-11-15 16:12 -------
Mainline gives an error message for f1 now, but still not for f2.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Ever Confirmed| |1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12913
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/12913] Jumps into variable length array scope not rejected
2003-11-05 17:23 [Bug c/12913] New: Jumps into variable length array scope not rejected falk at debian dot org
` (2 preceding siblings ...)
2003-11-15 16:12 ` falk at debian dot org
@ 2003-11-15 16:15 ` falk at debian dot org
2004-03-07 1:43 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: falk at debian dot org @ 2003-11-15 16:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From falk at debian dot org 2003-11-15 16:15 -------
Erm, I meant f and g, of course. And the misleading diagnostic worries me much
less than the accepts-invalid, which most likely will do something the user
didn't intend...
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12913
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/12913] Jumps into variable length array scope not rejected
2003-11-05 17:23 [Bug c/12913] New: Jumps into variable length array scope not rejected falk at debian dot org
` (3 preceding siblings ...)
2003-11-15 16:15 ` falk at debian dot org
@ 2004-03-07 1:43 ` pinskia at gcc dot gnu dot org
2004-08-11 21:05 ` jsm28 at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-07 1:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-07 01:43 -------
It is even worse (at least as I can see) on the tree-ssa because it will produce the
following code:
int a[l.1 * 4];
void * saved_stack.3;
long unsigned int T.2;
long unsigned int l.1;
int l.0;
<bb 0>:
switch (l)
{
case 1: goto <L0>;
default : goto <L1>;
}
<L0>:;
l.0 = 1;
l.1 = (long unsigned int)l.0;
T.2 = l.1 * 4;
__builtin_stack_alloc (&a, T.2);
<L1>:;
__builtin_stack_restore (saved_stack.3);
return;
so it will try do restore even though it did not save anything.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2004-03-07 01:43:34
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12913
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/12913] Jumps into variable length array scope not rejected
2003-11-05 17:23 [Bug c/12913] New: Jumps into variable length array scope not rejected falk at debian dot org
` (4 preceding siblings ...)
2004-03-07 1:43 ` pinskia at gcc dot gnu dot org
@ 2004-08-11 21:05 ` jsm28 at gcc dot gnu dot org
2005-04-19 23:53 ` jsm28 at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2004-08-11 21:05 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
OtherBugsDependingO| |16989
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12913
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/12913] Jumps into variable length array scope not rejected
2003-11-05 17:23 [Bug c/12913] New: Jumps into variable length array scope not rejected falk at debian dot org
` (5 preceding siblings ...)
2004-08-11 21:05 ` jsm28 at gcc dot gnu dot org
@ 2005-04-19 23:53 ` jsm28 at gcc dot gnu dot org
2005-04-20 16:42 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-04-19 23:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From jsm28 at gcc dot gnu dot org 2005-04-19 23:53 -------
Testing a fix. Note that the first case is a regression in 4.0 relative to
previous releases, so I'll propose the fix for 4.0.1.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jsm28 at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2005-04-07 08:06:31 |2005-04-19 23:53:18
date| |
Target Milestone|--- |4.0.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12913
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/12913] Jumps into variable length array scope not rejected
2003-11-05 17:23 [Bug c/12913] New: Jumps into variable length array scope not rejected falk at debian dot org
` (6 preceding siblings ...)
2005-04-19 23:53 ` jsm28 at gcc dot gnu dot org
@ 2005-04-20 16:42 ` cvs-commit at gcc dot gnu dot org
2005-04-22 12:59 ` [Bug c/12913] [4.0 Regression] " cvs-commit at gcc dot gnu dot org
2005-04-22 14:07 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-20 16:42 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-20 16:42 -------
Subject: Bug 12913
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: jsm28@gcc.gnu.org 2005-04-20 16:41:48
Modified files:
gcc : ChangeLog c-decl.c c-tree.h c-typeck.c
gcc/objc : ChangeLog objc-act.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gcc.dg: c99-vla-jump-1.c c99-vla-jump-2.c
c99-vla-jump-3.c c99-vla-jump-4.c
c99-vla-jump-5.c
Log message:
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.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8375&r2=2.8376
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.646&r2=1.647
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-tree.h.diff?cvsroot=gcc&r1=1.200&r2=1.201
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.433&r2=1.434
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/ChangeLog.diff?cvsroot=gcc&r1=1.32&r2=1.33
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/objc-act.c.diff?cvsroot=gcc&r1=1.269&r2=1.270
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5375&r2=1.5376
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-vla-jump-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-vla-jump-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-vla-jump-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-vla-jump-4.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-vla-jump-5.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12913
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/12913] [4.0 Regression] Jumps into variable length array scope not rejected
2003-11-05 17:23 [Bug c/12913] New: Jumps into variable length array scope not rejected falk at debian dot org
` (7 preceding siblings ...)
2005-04-20 16:42 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-22 12:59 ` cvs-commit at gcc dot gnu dot org
2005-04-22 14:07 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-22 12:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-22 12:59 -------
Subject: Bug 12913
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-4_0-branch
Changes by: jsm28@gcc.gnu.org 2005-04-22 12:58:43
Modified files:
gcc : ChangeLog c-decl.c c-tree.h c-typeck.c
gcc/objc : ChangeLog objc-act.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/gcc.dg: c99-vla-jump-1.c c99-vla-jump-2.c
c99-vla-jump-3.c c99-vla-jump-4.c
c99-vla-jump-5.c
Log message:
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.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.175&r2=2.7592.2.176
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.630.6.6&r2=1.630.6.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.193.4.2&r2=1.193.4.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.419.2.1&r2=1.419.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.29.8.2&r2=1.29.8.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/objc-act.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.266.6.1&r2=1.266.6.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.131&r2=1.5084.2.132
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-vla-jump-1.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-vla-jump-2.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-vla-jump-3.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-vla-jump-4.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/c99-vla-jump-5.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12913
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c/12913] [4.0 Regression] Jumps into variable length array scope not rejected
2003-11-05 17:23 [Bug c/12913] New: Jumps into variable length array scope not rejected falk at debian dot org
` (8 preceding siblings ...)
2005-04-22 12:59 ` [Bug c/12913] [4.0 Regression] " cvs-commit at gcc dot gnu dot org
@ 2005-04-22 14:07 ` pinskia at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-22 14:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-22 14:07 -------
Fixed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12913
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2005-04-22 14:07 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-05 17:23 [Bug c/12913] New: Jumps into variable length array scope not rejected falk at debian dot org
2003-11-08 16:44 ` [Bug c/12913] " pinskia at gcc dot gnu dot org
2003-11-14 16:33 ` dhazeghi at yahoo dot com
2003-11-15 16:12 ` falk at debian dot org
2003-11-15 16:15 ` falk at debian dot org
2004-03-07 1:43 ` pinskia at gcc dot gnu dot org
2004-08-11 21:05 ` jsm28 at gcc dot gnu dot org
2005-04-19 23:53 ` jsm28 at gcc dot gnu dot org
2005-04-20 16:42 ` cvs-commit at gcc dot gnu dot org
2005-04-22 12:59 ` [Bug c/12913] [4.0 Regression] " cvs-commit at gcc dot gnu dot org
2005-04-22 14:07 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).