tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] if (0 == 1) { some_code(); }


From: Michael Matz
Subject: Re: [Tinycc-devel] if (0 == 1) { some_code(); }
Date: Sun, 24 Apr 2016 20:37:46 +0200 (CEST)
User-agent: Alpine 2.20 (LSU 67 2015-01-07)

Hi,

On Sun, 24 Apr 2016, Sergey Korshunoff wrote:

What to do with 78_vla_label test? May be a tcc switch to skip unused code?

No.

void f1(int argc) {
 char test[argc];
 if(0)
 label:
   printf("boom!\n");
 if(argc-- == 0)
   return;
 goto label;
}

This is valid code, while your kernel example (and the implicit expectation in your printf example, that there's no reference to printf) is simply buggy code (buggy in that it doesn't provide the necessary definition of a symbol despite it being referenced).

TCC should foremost be able to compile correct code. "Optimizations" that make it sometimes also accept invalid code don't have a place in TCC IMHO, even less so if not trivial to implement. A switch that would do the wrong thing with valid code, while working around invalid code simply is a no-go to start with.


Ciao,
Michael.



reply via email to

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