tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] old nocode_wanted problem


From: Edmund Grimley Evans
Subject: Re: [Tinycc-devel] old nocode_wanted problem
Date: Sun, 22 Nov 2015 08:29:07 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

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



reply via email to

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