The condition is now cast to _Bool and it now works with return types bigger than 32 bit.
Unified · Split
| @@ -7980,23 +7980,26 @@ static void expr_eq(void) · 7979 unmodified lines | ||
| 7980 | 7980 | CType type, type1, type2; |
| 7981 | 7981 | |
| 7982 | 7982 | if (const_wanted) { |
| 7983 | − int c1, c; | |
| 7984 | 7983 | expr_lor_const(); |
| 7985 | 7984 | if (tok == '?') { |
| 7985 | + CType boolean; | |
| 7986 | + int c; | |
| 7987 | + boolean.t = VT_BOOL; | |
| 7988 | + vdup(); | |
| 7989 | + gen_cast(&boolean); | |
| 7986 | 7990 | c = vtop->c.i; |
| 7987 | 7991 | vpop(); |
| 7988 | 7992 | next(); |
| 7989 | − if (tok == ':' && gnu_ext) { | |
| 7990 | − c1 = c; | |
| 7991 | − } else { | |
| 7992 | − gexpr(); | |
| 7993 | − c1 = vtop->c.i; | |
| 7993 | + if (tok != ':' || !gnu_ext) { | |
| 7994 | 7994 | vpop(); |
| 7995 | + gexpr(); | |
| 7995 | 7996 | } |
| 7997 | + if (!c) | |
| 7998 | + vpop(); | |
| 7996 | 7999 | skip(':'); |
| 7997 | 8000 | expr_eq(); |
| 7998 | 8001 | if (c) |
| 7999 | − vtop->c.i = c1; | |
| 8002 | + vpop(); | |
| 8000 | 8003 | } |
| 8001 | 8004 | } else { |
| 8002 | 8005 | expr_lor(); |