提交 73c22f83 编辑于 作者: Michael Matz's avatar Michael Matz
浏览文件

Fix fallthrough of non-entered stmt expressions

commit ec5d9429 made is to that the nocode_wanted state from
inside a statement expression is retained after it.  That is wrong
if the statement expression can't be entered to start with.  In the
latter case the state from before the stmt-expr is the one we need.
上级 ebb4e712
......@@ -5394,9 +5394,12 @@ ST_FUNC void unary(void)
outside, so any reactivation of code emission (from labels
or loop heads) can be disabled again after the end of it. */
block(1);
/* or'ing to keep however possible CODE_OFF() from e.g. "return 0;"
in the statement expression */
nocode_wanted |= saved_nocode_wanted;
/* If the statement expr can be entered, then we retain the current
nocode_wanted state (from e.g. a 'return 0;' in the stmt-expr).
If it can't be entered then the state is that from before the
statement expression. */
if (saved_nocode_wanted)
nocode_wanted = saved_nocode_wanted;
skip(')');
} else {
gexpr();
......
......@@ -56,6 +56,15 @@ static void dowhile(void)
} while (check());
}
static void nondead_after_dead_return(void)
{
/* This statement expr is not entered, and hence that fact that it
doesn't fall-through should not influence the surrounding code. */
0 && ({ return; 0;});
printf ("nondead works\n");
return;
}
int main (void)
{
int i = 1;
......@@ -150,6 +159,7 @@ enterloop3:
}
dowhile();
nondead_after_dead_return();
return 0;
}
......@@ -21,3 +21,4 @@ check 1
g=2
check 2
g=3
nondead works
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册