Hello,
On Wed, 15 Jan 2020, Petr Skočík wrote:
I've just noticed `_Static_assert( !0 || 1/0, "");` fails to compile on
tinycc.
Thanks for the report, that shows that unevaluated sub-expressions of
const expressions were mishandled. We also diagnosed (incorrectly)
static int i = 2 || 1 / 0;
(which even is literally written down in the standard).
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.
Yeah, I've chosen a more complete solution, so that the latter is still
diagnosed, but the former isn't.
Ciao,
Michael.
_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel