From 74bdc065296cbca696c5e6c106932269a28fb38d Mon Sep 17 00:00:00 2001 From: Greg King Date: Tue, 1 Mar 2022 12:56:34 -0500 Subject: [PATCH] Added a more general test to test/val/bug1690.c --- test/val/bug1690.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/test/val/bug1690.c b/test/val/bug1690.c index 317913634..499dc6b35 100644 --- a/test/val/bug1690.c +++ b/test/val/bug1690.c @@ -2,22 +2,29 @@ #include +static int failures = 0; +static unsigned int z = 0xFF23; + int main(void) { register unsigned int x = 0x200; register unsigned int y = 0; - do - { + do { ++y; + } while (--x); + if (y != 0x200) { + printf("y should be 0x200, not 0x%X.\n", y); + ++failures;; } - while (--x); - if (y != 0x200) - { - printf("0x%X\n", y); - return 1; - } + if ((z -= 0x23)) { + /* Passed -- non-zero z looks like non-zero. */ + } else { + /* Failed -- only the low byte of z was tested. */ + printf("Test thinks non-zero z is zero.\n"); + ++failures; + } - return 0; + return failures; }