scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 3d2ccb36333113f1c1e71191926f2b5f5e3a64f6
parent 289a91810b16fd9211964235252b071bf900627b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu,  7 May 2015 08:09:35 +0200

Fix problem in condition()

If() calls to condition(), which can fail, so the Node pointer returned
was not always a condition, so the call to negate could abort() because it.
This patch enforces that return value of condition is always a comparition.

Diffstat:
cc1/stmt.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cc1/stmt.c b/cc1/stmt.c @@ -56,9 +56,10 @@ condition(void) expect('('); setsafe(END_COND); if (!setjmp(recover)) - np = iszero(expr()); + np = expr(); else np = symbol(zero); + np = iszero(np); expect(')'); return np; }