Sergey:

> There may be some other bugs in tcc related to nocode_wanted

Yes. I tried to fix one, for sizeof(!x), last night, though I'm not
sure I fixed it correctly; perhaps save_regs should be conditional on
nocode_wanted. It's a mess.

> Check commit 78c076a70f5
>       The following check in tccgen.c is removed
>         if (nocode_wanted)
>         tcc_error("statement expression in global scope");
>     This check is introduced in commit 5bcc3eed7b93 and breaks compilation
>     of the linux 2.4.26 kernel.

That commit looks good to me, or at least the original code looks
wrong. There are several circumstances in which nocode_wanted is set,
and the most obvious one is when parsing the argument of sizeof, not
global scope. (However, I don't like the way you cluttered up the code
with a giant comment. And it would be better to justify the change
with a small test case, either in tests/ or in the commit message.)

> A test program related to this issue:

I assume that test now works. It is likely to have been affected by my
recent commits, which set nocode_wanted when parsing X in (0 ? X : Y),
(1 ? Y : X), (0 && X), (1 || X). I note that assert(1 == 1) now
generates no code. A few days ago it generated a load of code with an
unconditional branch round it.

Edmund

_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to