diff options
| author | Michael Matz <matz@suse.de> | 2016-09-03 23:23:13 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2016-12-15 17:47:11 +0100 |
| commit | 49bb5a7e06049c771a28a2cc507c7789dc54a88b (patch) | |
| tree | cb865f97ddb043b5562c5688c1219352931deb59 /tccgen.c | |
| parent | 5bd8aeb917ed326f50b1ed45669a1cf40aca75a3 (diff) | |
| download | tinycc-49bb5a7e06049c771a28a2cc507c7789dc54a88b.tar.gz tinycc-49bb5a7e06049c771a28a2cc507c7789dc54a88b.tar.bz2 | |
Fix __builtin_constant_p(1000/x)
was incorrectly treated as constant because the vpop removed
all traces of non-constness.
Diffstat (limited to 'tccgen.c')
| -rw-r--r-- | tccgen.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -1787,6 +1787,13 @@ static void gen_opic(int op) gen_opi(op); } else { vtop--; + /* Ensure vtop isn't marked VT_CONST in case something + up our callchain is interested in const-ness of the + expression. Also make it a non-LVAL if it was, + so that further code can't accidentally generate + a deref (happen only for buggy uses of e.g. + gv() under nocode_wanted). */ + vtop->r &= ~(VT_VALMASK | VT_LVAL); } } } @@ -5014,6 +5021,16 @@ static void expr_cond(void) } } else { + /* XXX This doesn't handle nocode_wanted correctly at all. + It unconditionally calls gv/gvtst and friends. That's + the case for many of the expr_ routines. Currently + that should generate only useless code, but depending + on other operand handling this might also generate + pointer derefs for lvalue conversions whose result + is useless, but nevertheless can lead to segfault. + + Somewhen we need to overhaul the whole nocode_wanted + handling. */ if (vtop != vstack) { /* needed to avoid having different registers saved in each branch */ |
