aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tccgen.c b/tccgen.c
index 5eabc70..5e52f29 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -4522,9 +4522,13 @@ static void expr_cond(void)
SValue sv;
CType type, type1, type2;
- if (const_wanted) {
+ if (const_wanted)
expr_lor_const();
- if (tok == '?') {
+ else
+ expr_lor();
+ if (tok == '?') {
+ next();
+ if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) {
CType boolean;
int c;
boolean.t = VT_BOOL;
@@ -4532,7 +4536,6 @@ static void expr_cond(void)
gen_cast(&boolean);
c = vtop->c.i;
vpop();
- next();
if (tok != ':' || !gnu_ext) {
vpop();
gexpr();
@@ -4544,10 +4547,7 @@ static void expr_cond(void)
if (c)
vpop();
}
- } else {
- expr_lor();
- if (tok == '?') {
- next();
+ else {
if (vtop != vstack) {
/* needed to avoid having different registers saved in
each branch */