tests/tests2/78_vla_label.*: Add test.
Unified · Split
| @@ -4468,8 +4468,11 @@ static void expr_land(void) · 4467 unmodified lines | |||
| 4468 | expr_land(); | 4468 | expr_land(); |
| 4469 | gen_cast(&ctb); | 4469 | gen_cast(&ctb); |
| 4470 | } else { | 4470 | } else { |
| 4471 | int saved_nocode_wanted = nocode_wanted; | ||
| 4472 | nocode_wanted = 1; | ||
| 4471 | expr_land(); | 4473 | expr_land(); |
| 4472 | vpop(); | 4474 | vpop(); |
| 4475 | nocode_wanted = saved_nocode_wanted; | ||
| 4473 | } | 4476 | } |
| 4474 | gen_cast(&cti); | 4477 | gen_cast(&cti); |
| 4475 | } else { | 4478 | } else { |
| @@ -4499,8 +4502,11 @@ static void expr_lor(void) · 23 unmodified lines | |||
| 4499 | next(); | 4502 | next(); |
| 4500 | gen_cast(&ctb); | 4503 | gen_cast(&ctb); |
| 4501 | if (vtop->c.i) { | 4504 | if (vtop->c.i) { |
| 4505 | int saved_nocode_wanted = nocode_wanted; | ||
| 4506 | nocode_wanted = 1; | ||
| 4502 | expr_lor(); | 4507 | expr_lor(); |
| 4503 | vpop(); | 4508 | vpop(); |
| 4509 | nocode_wanted = saved_nocode_wanted; | ||
| 4504 | } else { | 4510 | } else { |
| 4505 | vpop(); | 4511 | vpop(); |
| 4506 | expr_lor(); | 4512 | expr_lor(); |
| @@ -4533,6 +4539,7 @@ static void expr_cond(void) · 26 unmodified lines | |||
| 4533 | if (tok == '?') { | 4539 | if (tok == '?') { |
| 4534 | next(); | 4540 | next(); |
| 4535 | if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) { | 4541 | if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) { |
| 4542 | int saved_nocode_wanted = nocode_wanted; | ||
| 4536 | CType boolean; | 4543 | CType boolean; |
| 4537 | int c; | 4544 | int c; |
| 4538 | boolean.t = VT_BOOL; | 4545 | boolean.t = VT_BOOL; |
| @@ -4540,16 +4547,27 @@ static void expr_cond(void) · 1 unmodified line | |||
| 4540 | gen_cast(&boolean); | 4547 | gen_cast(&boolean); |
| 4541 | c = vtop->c.i; | 4548 | c = vtop->c.i; |
| 4542 | vpop(); | 4549 | vpop(); |
| 4543 | if (tok != ':' || !gnu_ext) { | 4550 | if (c) { |
| 4544 | vpop(); | 4551 | if (tok != ':' || !gnu_ext) { |
| 4545 | gexpr(); | 4552 | vpop(); |
| 4546 | } | 4553 | gexpr(); |
| 4547 | if (!c) | 4554 | } |
| 4555 | skip(':'); | ||
| 4556 | nocode_wanted = 1; | ||
| 4557 | expr_cond(); | ||
| 4548 | vpop(); | 4558 | vpop(); |
| 4549 | skip(':'); | 4559 | nocode_wanted = saved_nocode_wanted; |
| 4550 | expr_cond(); | 4560 | } else { |
| 4551 | if (c) | ||
| 4552 | vpop(); | 4561 | vpop(); |
| 4562 | if (tok != ':' || !gnu_ext) { | ||
| 4563 | nocode_wanted = 1; | ||
| 4564 | gexpr(); | ||
| 4565 | vpop(); | ||
| 4566 | nocode_wanted = saved_nocode_wanted; | ||
| 4567 | } | ||
| 4568 | skip(':'); | ||
| 4569 | expr_cond(); | ||
| 4570 | } | ||
| 4553 | } | 4571 | } |
| 4554 | else { | 4572 | else { |
| 4555 | if (vtop != vstack) { | 4573 | if (vtop != vstack) { |
| @@ -27,10 +27,19 @@ void f2(void) · 26 unmodified lines | |||
| 27 | } | 27 | } |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | void f3(void) | ||
| 31 | { | ||
| 32 | printf("%d\n", 0 ? printf("x1\n") : 11); | ||
| 33 | printf("%d\n", 1 ? 12 : printf("x2\n")); | ||
| 34 | printf("%d\n", 0 && printf("x3\n")); | ||
| 35 | printf("%d\n", 1 || printf("x4\n")); | ||
| 36 | } | ||
| 37 | |||
| 30 | int main() | 38 | int main() |
| 31 | { | 39 | { |
| 32 | f1(2); | 40 | f1(2); |
| 33 | f2(); | 41 | f2(); |
| 42 | f3(); | ||
| 34 | 43 | ||
| 35 | return 0; | 44 | return 0; |
| 36 | } | 45 | } |
| @@ -1,2 +1,6 @@ | |||
| 1 | boom! | 1 | boom! |
| 2 | boom! | 2 | boom! |
| 3 | 11 | ||
| 4 | 12 | ||
| 5 | 0 | ||
| 6 | 1 | ||