From b5f255f9123dc898e494321406edd434b89a6d49 Mon Sep 17 00:00:00 2001 From: bbbradsmith Date: Wed, 3 May 2023 19:54:40 -0400 Subject: [PATCH] Test case for const-overflow warnings --- test/err/integer-const-overflow.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/err/integer-const-overflow.c diff --git a/test/err/integer-const-overflow.c b/test/err/integer-const-overflow.c new file mode 100644 index 000000000..37cc0f01e --- /dev/null +++ b/test/err/integer-const-overflow.c @@ -0,0 +1,20 @@ +/* Integer constant overflow warnings. */ + +/* Warnings as errors. */ +#pragma warn(error,on) + +/* Warn on const overflow */ +#pragma warn(const-overflow,on) + +unsigned char a = 256; +signed char b = 128; +unsigned char c = -129; +unsigned short int d = 0x00010000; +unsigned short int e = 0x80000000; +signed short int f = 32768L; +signed short int g = -32769L; + +int main(void) +{ + return 0; +}