1 /* 2 pr40057.c from the execute part of the gcc torture tests. 3 */ 4 5 #include <testfwk.h> 6 7 #ifdef __SDCC 8 #pragma std_c99 9 #endif 10 11 // TODO: Enable when sdcc supports long long in these ports! 12 #if !defined(__SDCC_pic14) && !defined(__SDCC_pic16) 13 /* PR middle-end/40057 */ 14 15 int foo(unsigned long long x)16foo (unsigned long long x) 17 { 18 unsigned long long y = (x >> 31ULL) & 1ULL; 19 if (y == 0ULL) 20 return 0; 21 return -1; 22 } 23 24 int bar(long long x)25bar (long long x) 26 { 27 long long y = (x >> 31LL) & 1LL; 28 if (y == 0LL) 29 return 0; 30 return -1; 31 } 32 #endif 33 34 void testTortureExecute(void)35testTortureExecute (void) 36 { 37 #ifndef PORT_HOST // Fails on NetBSD 38 #if !defined(__SDCC_pic14) && !defined(__SDCC_pic16) 39 if (sizeof (long long) != 8) 40 return; 41 if (foo (0x1682a9aaaULL)) 42 ASSERT (0); 43 if (!foo (0x1882a9aaaULL)) 44 ASSERT (0); 45 if (bar (0x1682a9aaaLL)) 46 ASSERT (0); 47 if (!bar (0x1882a9aaaLL)) 48 ASSERT (0); 49 return; 50 #endif 51 #endif 52 } 53 54