1/* { dg-do run } */ 2/* { dg-require-effective-target int128 } */ 3/* { dg-options "-fsanitize=signed-integer-overflow" } */ 4 5/* 2^127 - 1 */ 6#define INT128_MAX (__int128) (((unsigned __int128) 1 << ((__SIZEOF_INT128__ * __CHAR_BIT__) - 1)) - 1) 7#define INT128_MIN (-INT128_MAX - 1) 8 9int 10main (void) 11{ 12 volatile __int128 i = INT128_MAX; 13 volatile __int128 j = 1; 14 volatile __int128 k = i + j; 15 k = j + i; 16 i++; 17 j = INT128_MAX - 100; 18 j += (1 << 10); 19 20 j = INT128_MIN; 21 i = -1; 22 k = i + j; 23 k = j + i; 24 j--; 25 j = INT128_MIN + 100; 26 j += -(1 << 10); 27 28 i = INT128_MAX; 29 j = 2; 30 k = i * j; 31 32 i = INT128_MIN; 33 i = -i; 34 35 return 0; 36} 37 38/* { dg-output "signed integer overflow: 0x7fffffffffffffffffffffffffffffff \\+ 1 cannot be represented in type '__int128'(\n|\r\n|\r)" } */ 39/* { dg-output "\[^\n\r]*signed integer overflow: 1 \\+ 0x7fffffffffffffffffffffffffffffff cannot be represented in type '__int128'(\n|\r\n|\r)" } */ 40/* { dg-output "\[^\n\r]*signed integer overflow: 0x7fffffffffffffffffffffffffffffff \\+ 1 cannot be represented in type '__int128'(\n|\r\n|\r)" } */ 41/* { dg-output "\[^\n\r]*signed integer overflow: 0x7fffffffffffffffffffffffffffff9b \\+ 1024 cannot be represented in type '__int128'(\n|\r\n|\r)" } */ 42/* { dg-output "\[^\n\r]*signed integer overflow: -1 \\+ 0x80000000000000000000000000000000 cannot be represented in type '__int128'(\n|\r\n|\r)" } */ 43/* { dg-output "\[^\n\r]*signed integer overflow: 0x80000000000000000000000000000000 \\+ -1 cannot be represented in type '__int128'(\n|\r\n|\r)" } */ 44/* { dg-output "\[^\n\r]*signed integer overflow: 0x80000000000000000000000000000000 - 1 cannot be represented in type '__int128'(\n|\r\n|\r)" } */ 45/* { dg-output "\[^\n\r]*signed integer overflow: 0x80000000000000000000000000000064 \\+ -1024 cannot be represented in type '__int128'(\n|\r\n|\r)" } */ 46/* { dg-output "\[^\n\r]*signed integer overflow: 0x7fffffffffffffffffffffffffffffff \\* 2 cannot be represented in type '__int128'(\n|\r\n|\r)" } */ 47/* { dg-output "\[^\n\r]*negation of 0x80000000000000000000000000000000 cannot be represented in type '__int128'; cast to an unsigned type to negate this value to itself\[^\n\r]*(\n|\r\n|\r)" } */ 48