... Found something:

1) in vcheck_cmp():
    if (vtop->r == VT_CMP && !nocode_wanted --> && vtop->cmp_op > 1)
doesn't work, see the test I sent earlier.

2) in expr_landor():
    if (f) {
        vpop();
        vpushi(!i);
        nocode_wanted -= f;
    }
    gvtst_set(i, t);

This doesn't work as is with for example
    c = a && 0 ? 2 : 3;
because expr_cond() would turn off code at its first gvtst()
and never on again.

option 1:
    if (f || condition_3way() == !i) {
        vpop();
        vpushi(!i);
        gsym(t);
        nocode_wanted -= f;
    } else
        gvtst_set(i, t);

This appears to generate byte-identical code to before, with my tests.

option 2:
    moving up 'ncw_prev = nocode_wanted;'.
This appears to work too but generates more code.

It's all somehow brittle, with the mix of ++/-- with |=/&= nocode_wanted.

Sigh,

--- grischka


_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to