public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/772] Statement expressions issues
       [not found] <20001111043600.772.jsm28@gcc.gnu.org>
@ 2005-03-30 19:56 ` cvs-commit at gcc dot gnu dot org
  2005-03-30 19:59 ` cvs-commit at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-30 19:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-03-30 19:56 -------
Subject: Bug 772

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	jsm28@gcc.gnu.org	2005-03-30 19:56:40

Modified files:
	gcc            : ChangeLog c-decl.c c-tree.h c-typeck.c 
	gcc/doc        : extend.texi 
	gcc/objc       : ChangeLog objc-act.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: stmt-expr-label-1.c stmt-expr-label-2.c 
	                      stmt-expr-label-3.c 
Removed files:
	gcc/testsuite/gcc.c-torture/execute: medce-2.c 

Log message:
	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.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8036&r2=2.8037
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&r1=1.642&r2=1.643
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-tree.h.diff?cvsroot=gcc&r1=1.198&r2=1.199
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-typeck.c.diff?cvsroot=gcc&r1=1.428&r2=1.429
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/extend.texi.diff?cvsroot=gcc&r1=1.246&r2=1.247
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/ChangeLog.diff?cvsroot=gcc&r1=1.31&r2=1.32
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/objc/objc-act.c.diff?cvsroot=gcc&r1=1.267&r2=1.268
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5237&r2=1.5238
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/medce-2.c.diff?cvsroot=gcc&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/stmt-expr-label-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/stmt-expr-label-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/stmt-expr-label-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=772


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/772] Statement expressions issues
       [not found] <20001111043600.772.jsm28@gcc.gnu.org>
  2005-03-30 19:56 ` [Bug c/772] Statement expressions issues cvs-commit at gcc dot gnu dot org
@ 2005-03-30 19:59 ` cvs-commit at gcc dot gnu dot org
  2005-03-31  7:26 ` [Bug c++/772] " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-03-30 19:59 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-03-30 19:59 -------
Subject: Bug 772

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	jsm28@gcc.gnu.org	2005-03-30 19:59:21

Modified files:
	gcc            : ChangeLog c-decl.c c-tree.h c-typeck.c 
	gcc/doc        : extend.texi 
	gcc/objc       : ChangeLog objc-act.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: stmt-expr-label-1.c stmt-expr-label-2.c 
	                      stmt-expr-label-3.c 
Removed files:
	gcc/testsuite/gcc.c-torture/execute: medce-2.c 

Log message:
	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.

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.97&r2=2.7592.2.98
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.3&r2=1.630.6.4
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.1&r2=1.193.4.2
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&r2=1.419.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/extend.texi.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.240.2.5&r2=1.240.2.6
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&r2=1.29.8.1
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&r2=1.266.6.1
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.80&r2=1.5084.2.81
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/medce-2.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.1&r2=NONE
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/stmt-expr-label-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/stmt-expr-label-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/stmt-expr-label-3.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=772


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/772] Statement expressions issues
       [not found] <20001111043600.772.jsm28@gcc.gnu.org>
  2005-03-30 19:56 ` [Bug c/772] Statement expressions issues cvs-commit at gcc dot gnu dot org
  2005-03-30 19:59 ` cvs-commit at gcc dot gnu dot org
@ 2005-03-31  7:26 ` pinskia at gcc dot gnu dot org
  2005-04-03 18:56 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-31  7:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-31 07:26 -------
Only a C++ front-end problem now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |c++


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=772


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/772] Statement expressions issues
       [not found] <20001111043600.772.jsm28@gcc.gnu.org>
                   ` (2 preceding siblings ...)
  2005-03-31  7:26 ` [Bug c++/772] " pinskia at gcc dot gnu dot org
@ 2005-04-03 18:56 ` pinskia at gcc dot gnu dot org
  2005-09-09 12:38 ` rguenth at gcc dot gnu dot org
  2005-09-09 15:41 ` joseph at codesourcery dot com
  5 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-03 18:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-03 18:56 -------
*** Bug 20741 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at pld-linux dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=772


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/772] Statement expressions issues
       [not found] <20001111043600.772.jsm28@gcc.gnu.org>
                   ` (3 preceding siblings ...)
  2005-04-03 18:56 ` pinskia at gcc dot gnu dot org
@ 2005-09-09 12:38 ` rguenth at gcc dot gnu dot org
  2005-09-09 15:41 ` joseph at codesourcery dot com
  5 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-09-09 12:38 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-09-09 12:38 -------
No testcase?  But I think this is fixed on the mainline and only pending on 4.0.
See PR17913.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=772


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c++/772] Statement expressions issues
       [not found] <20001111043600.772.jsm28@gcc.gnu.org>
                   ` (4 preceding siblings ...)
  2005-09-09 12:38 ` rguenth at gcc dot gnu dot org
@ 2005-09-09 15:41 ` joseph at codesourcery dot com
  5 siblings, 0 replies; 9+ messages in thread
From: joseph at codesourcery dot com @ 2005-09-09 15:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From joseph at codesourcery dot com  2005-09-09 15:41 -------
Subject: Re:  Statement expressions issues

On Fri, 9 Sep 2005, rguenth at gcc dot gnu dot org wrote:

> No testcase?  But I think this is fixed on the mainline and only pending on 4.0.
> See PR17913.

The test is gcc.dg/stmt-expr-label-*.c (modulo the exact diagnostic text) 
and I don't think this is fixed for C++ on mainline.  This is separate 
from bug 17913 where there is a case which is valid at compile time and 
invalid at runtime, involving computed gotos: 
gcc.c-torture/compile/pr17913.c, which formerly ICEd with optimization but 
was fixed not to do so (at least for C; appears fixed for C++ as well with 
the mainline/4.0 compilers I have to hand to test but they are rather 
old).  It just happens that almost all cases of bug 17913 were addressed 
for C by fixing bug 772 for C, leaving only the case of computed gotos to 
be fixed separately in 17913 (for C).

The rules for invalidity for jumps into statement expressions are much the 
same as those in C++ for jumps bypassing initializations (imagining that 
each statement expression starts with such an initialization); it might be 
possible to reuse that code to fix this bug for C++.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=772


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/772] Statement expressions issues
       [not found] <20001111043600.772.jsm-gccbugs@polyomino.org.uk>
  2004-10-27 13:21 ` [Bug c/772] " bangerth at dealii dot org
@ 2004-10-27 13:24 ` bangerth at dealii dot org
  1 sibling, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-10-27 13:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-10-27 13:24 -------
Some more discussion here: 
  http://gcc.gnu.org/ml/gcc-patches/2004-10/msg02310.html 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=772


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/772] Statement expressions issues
       [not found] <20001111043600.772.jsm-gccbugs@polyomino.org.uk>
@ 2004-10-27 13:21 ` bangerth at dealii dot org
  2004-10-27 13:24 ` bangerth at dealii dot org
  1 sibling, 0 replies; 9+ messages in thread
From: bangerth at dealii dot org @ 2004-10-27 13:21 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-10-27 13:21 -------
A similar problem are jumps via 'break'/'continue' out of statement 
expressions. Here's a place where people have really used this: 
  http://gcc.gnu.org/ml/gcc-patches/2003-05/msg00706.html 
(Isn't the ability of people to come up with really bad ideas amazing?) 
 
W. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=772


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/772] Statement expressions issues
       [not found] <20001111043600.772.jsm28@cam.ac.uk>
@ 2003-07-14  3:47 ` neroden at gcc dot gnu dot org
  0 siblings, 0 replies; 9+ messages in thread
From: neroden at gcc dot gnu dot org @ 2003-07-14  3:47 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=772


neroden at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|0000-00-00 00:00:00         |2003-07-14 03:47:16
               date|                            |


------- Additional Comments From neroden at gcc dot gnu dot org  2003-07-14 03:47 -------
Alternate fix: eliminate the statement expression extension.  But you all knew that.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-09-09 15:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20001111043600.772.jsm28@gcc.gnu.org>
2005-03-30 19:56 ` [Bug c/772] Statement expressions issues cvs-commit at gcc dot gnu dot org
2005-03-30 19:59 ` cvs-commit at gcc dot gnu dot org
2005-03-31  7:26 ` [Bug c++/772] " pinskia at gcc dot gnu dot org
2005-04-03 18:56 ` pinskia at gcc dot gnu dot org
2005-09-09 12:38 ` rguenth at gcc dot gnu dot org
2005-09-09 15:41 ` joseph at codesourcery dot com
     [not found] <20001111043600.772.jsm-gccbugs@polyomino.org.uk>
2004-10-27 13:21 ` [Bug c/772] " bangerth at dealii dot org
2004-10-27 13:24 ` bangerth at dealii dot org
     [not found] <20001111043600.772.jsm28@cam.ac.uk>
2003-07-14  3:47 ` neroden 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).