Merge pull request #2084 from bbbradsmith/numerical_constant_errors-int
Numerical constant errors and improvements (integer)
This commit is contained in:
7
test/err/huge-integer-constant.c
Normal file
7
test/err/huge-integer-constant.c
Normal file
@@ -0,0 +1,7 @@
|
||||
/* too big for internal integer representation */
|
||||
unsigned long huge = 4294967296;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
20
test/err/integer-const-overflow.c
Normal file
20
test/err/integer-const-overflow.c
Normal file
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user