I've just noticed `_Static_assert( !0 || 1/0, "");` fails to compile on
tinycc.

I had an overflow-checking macro expand to code like this and got a
compiler error from it on tinycc.

I've since changed the macro to have a redundant ternary in the divisor
(which works around the error and it should affect optimizing
compilers), but just in case somebody wants to fix this...

It seems to me like simply commenting out the

                if (const_wanted)
                    tcc_error("division by zero in constant");

at tccgen.c:2090 could do the trick.

Then we get a less specific "constant expression expected" instead of
"division by zero in constant" for  "enum { a = 1/0 };", but perhaps
fancy diagnostics are best left to big compilers.

Regards,
Petr Skocik

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

Reply via email to