------- Additional Comments From jsm at polyomino dot org dot uk 2004-10-27 12:55 ------- Subject: Re: [4.0 Regression] ICE jumping into statement expression
On Wed, 27 Oct 2004, steven at gcc dot gnu dot org wrote: > Surely this is not valid? The validity is the subject of bug 772 and the long thread linked from there. This bug is for a particular ICE which is a regression; whether the code is valid or invalid depends on whether any resolution suggested in bug 772 or elsewhere is adopted. I haven't seen a use for jumps into statement expressions and think we should disallow them. This isn't as simple as making the labels local to the statement expression. First, you need to check for switch statements jumping into the statement expression. Second, if inside a statement expression you encounter a reference to an undeclared label, you don't know whether it refers to one later within that statement expression or one outside in the function (and in an address-of-label context, both could reasonably be valid) so don't know in what scope to declare the label (or, if there's one outside already seen with that name, whether the new one is a reference to that label or to a new local one). For that reason I think it's best to keep the current scoping rules and have a separate check for any form of jumps into statement expressions, with jumps by computed goto explicitly runtime undefined. (While jumps in from longjmp might be OK.) Jumps out of statement expressions are or were used in real code <http://gcc.gnu.org/ml/gcc-patches/2003-05/msg00770.html>. I don't think they are well-defined (except for jumps using longjmp), but I believe we need a deprecation period before removing them (e.g. deprecate in 4.0, remove in 4.1). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17913