[Top][All Lists]

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

[Tinycc-devel] crash with simple bad macro

From: Hernán J . González
Subject: [Tinycc-devel] crash with simple bad macro
Date: Mon, 14 Sep 2015 17:53:33 -0300

The following crashes tcc 0.9.26 :

typedef struct X { int len; } X;

#define init(s,len)  s.len = len;

int main(void) {
   X myX;
   return 0;

Of course, the macro is wrong, because it uses the same field name of the struct
as a placeholder id, hence the statement in main turns into 
   myX.10 = 10 ;
instead of 
   myX.len = 10 ;
as desired.

The issue, of course, is that the compiler should not crash.
gcc (3.4.5 in mingw) outputs: "error: syntax error before numeric constant"

Strangely, if I directly writes "myX.10 = 10 ;" in the main body, tcc does not crash,
but the error message is quite strange:

    " error: ';' expected (got "└")"

Hernán J. González
Buenos Aires, Argentina

reply via email to

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