scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 04b9d5bad1698e233f405703461f5da1be3a1e65
parent d11e94df0f60fd433115496b04f555473b8d7c49
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  6 Jan 2025 22:18:42 +0100

tests/cc: Add 0229-commaloc

Diffstat:
Atests/cc/execute/0229-commalog.c | 24++++++++++++++++++++++++
Mtests/cc/execute/scc-tests.lst | 1+
2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/tests/cc/execute/0229-commalog.c b/tests/cc/execute/0229-commalog.c @@ -0,0 +1,24 @@ +int a, b, c; + +#include <stdio.h> + +int +main() +{ + int d; + + d = a = 1, b = 2, c = 3; + if (d != 1) + return 1; + d = c, a || b; + if (d != 3) + return 2; + d = (c, a || b); + if (d != 1) + return 3; + d = a && (a = b + 2, a = 0); + if (d != 0) + return 4; + + return 0; +} diff --git a/tests/cc/execute/scc-tests.lst b/tests/cc/execute/scc-tests.lst @@ -219,3 +219,4 @@ 0226-pointer.c 0227-sizeof.c 0228-extrcast.c +0229-commalog.c