modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/pr29695-2.c (about) 1 /* PR middle-end/29695 */ 2 3 extern void abort (void); 4 5 int a = 128; 6 unsigned char b = 128; 7 long long c = 0x80000000LL; 8 unsigned int d = 0x80000000; 9 10 int 11 f1 (void) 12 { 13 return (a & 0x80) ? 0x80 : 0; 14 } 15 16 int 17 f2 (void) 18 { 19 return (b & 0x80) ? 0x80 : 0; 20 } 21 22 int 23 f3 (void) 24 { 25 return (b & 0x80) ? 0x380 : 0; 26 } 27 28 int 29 f4 (void) 30 { 31 return (b & 0x80) ? -128 : 0; 32 } 33 34 long long 35 f5 (void) 36 { 37 return (c & 0x80000000) ? 0x80000000LL : 0LL; 38 } 39 40 long long 41 f6 (void) 42 { 43 return (d & 0x80000000) ? 0x80000000LL : 0LL; 44 } 45 46 long long 47 f7 (void) 48 { 49 return (d & 0x80000000) ? 0x380000000LL : 0LL; 50 } 51 52 long long 53 f8 (void) 54 { 55 return (d & 0x80000000) ? -2147483648LL : 0LL; 56 } 57 58 int 59 main (void) 60 { 61 if ((char) 128 != -128 || (int) 0x80000000 != -2147483648) 62 return 0; 63 if (f1 () != 128) 64 abort (); 65 if (f2 () != 128) 66 abort (); 67 if (f3 () != 896) 68 abort (); 69 if (f4 () != -128) 70 abort (); 71 if (f5 () != 0x80000000LL) 72 abort (); 73 if (f6 () != 0x80000000LL) 74 abort (); 75 if (f7 () != 0x380000000LL) 76 abort (); 77 if (f8 () != -2147483648LL) 78 abort (); 79 return 0; 80 }