Not fully thought out. You can't jump inside stmt exprs, but you can jump out of them. So there's a difference between undefined but declared labels at the end of stmt exprs and those defined inside. Additionally it should also be checked if a label defined inside a stmt expr was tentatively created as declared from outside. I'm not prepared doing that right now, so simply revert. This reverts commit 9160e4cab9147d77840cc44a285031fdb4640cf9.
Unified · Split
| @@ -5418,7 +5418,7 @@ static void block(int *bsym, int *csym, int is_expr) · 5417 unmodified lines | ||
| 5418 | 5418 | gsym(a); |
| 5419 | 5419 | gsym_addr(b, d); |
| 5420 | 5420 | } else if (tok == '{') { |
| 5421 | − Sym *llabel, *glabel; | |
| 5421 | + Sym *llabel; | |
| 5422 | 5422 | int block_vla_sp_loc = vla_sp_loc, saved_vlas_in_scope = vlas_in_scope; |
| 5423 | 5423 | |
| 5424 | 5424 | next(); |
| @@ -5426,10 +5426,6 @@ static void block(int *bsym, int *csym, int is_expr) · 1 unmodified line | ||
| 5426 | 5426 | s = local_stack; |
| 5427 | 5427 | llabel = local_label_stack; |
| 5428 | 5428 | ++local_scope; |
| 5429 | − /* Labels defined inside statement expressions aren't | |
| 5430 | − available from the outside, so record that as well. */ | |
| 5431 | − if (is_expr) | |
| 5432 | − glabel = global_label_stack; | |
| 5433 | 5429 | |
| 5434 | 5430 | /* handle local labels declarations */ |
| 5435 | 5431 | if (tok == TOK_LABEL) { |
| @@ -5455,8 +5451,6 @@ static void block(int *bsym, int *csym, int is_expr) · 19 unmodified lines | ||
| 5455 | 5451 | block(bsym, csym, is_expr); |
| 5456 | 5452 | } |
| 5457 | 5453 | } |
| 5458 | − if (is_expr) | |
| 5459 | − label_pop(&global_label_stack, glabel); | |
| 5460 | 5454 | /* pop locally defined labels */ |
| 5461 | 5455 | label_pop(&local_label_stack, llabel); |
| 5462 | 5456 | /* pop locally defined symbols */ |