From 517df130ccdba93d99d27ab7fb42676cc84ce18e Mon Sep 17 00:00:00 2001 From: Greg King Date: Mon, 20 Jul 2020 17:16:11 -0400 Subject: [PATCH] Made a regression test increment a variable after, instead of before, using it. That change allows the initial value of zero to be tested. --- test/val/bug1108.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/test/val/bug1108.c b/test/val/bug1108.c index 17ef022c3..1cd23c8e5 100644 --- a/test/val/bug1108.c +++ b/test/val/bug1108.c @@ -7,34 +7,31 @@ unsigned char x = 0; -unsigned char PrintVar1(void) +static unsigned char PrintVar1(void) { unsigned char cx = x + 1; + printf("cx:%d x:%d\n", cx, x); return cx == 0; } -unsigned char PrintVar2(void) +static unsigned char PrintVar2(void) { unsigned char cx = x + 1; unsigned char cy; + cy = x + 1; printf("cx:%d cy:%d x:%d\n", cx, cy, x); return cx != cy; } -#pragma static-locals (off) - -unsigned char n; -unsigned char ret = 0; +static unsigned char ret = 0; int main(void) { - for (n = 0; n < 10; n++) { - ++x; + do { ret |= PrintVar1(); ret |= PrintVar2(); - } + } while (++x < 10); return ret; } -