tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Buggy commit "Rework expr_landor"


From: grischka
Subject: Re: [Tinycc-devel] Buggy commit "Rework expr_landor"
Date: Tue, 21 Jan 2020 00:45:03 +0100
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

... 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]