Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/c-c++-common/torture/pr87248.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* PR middle-end/87248 */ | |
2 /* { dg-do run } */ | |
3 | |
4 void | |
5 foo (signed char *p, int q) | |
6 { | |
7 *p = q & (-__SCHAR_MAX__ - 1) ? (-__SCHAR_MAX__ - 1) : 0; | |
8 } | |
9 | |
10 int | |
11 bar (long long x) | |
12 { | |
13 return x & (-__INT_MAX__ - 1) ? (-__INT_MAX__ - 1) : 0; | |
14 } | |
15 | |
16 int | |
17 main () | |
18 { | |
19 #if __INT_MAX__ > 4 * __SCHAR_MAX__ | |
20 signed char a[4]; | |
21 foo (a, __SCHAR_MAX__ + 1U); | |
22 foo (a + 1, 2 * (__SCHAR_MAX__ + 1U)); | |
23 foo (a + 2, -__INT_MAX__ - 1); | |
24 foo (a + 3, (__SCHAR_MAX__ + 1U) / 2); | |
25 if (a[0] != (-__SCHAR_MAX__ - 1) || a[1] != a[0] || a[2] != a[0] || a[3] != 0) | |
26 __builtin_abort (); | |
27 #endif | |
28 #if __LONG_LONG_MAX__ > 4 * __INT_MAX__ | |
29 if (bar (__INT_MAX__ + 1LL) != (-__INT_MAX__ - 1) | |
30 || bar (2 * (__INT_MAX__ + 1LL)) != (-__INT_MAX__ - 1) | |
31 || bar (-__LONG_LONG_MAX__ - 1) != (-__INT_MAX__ - 1) | |
32 || bar ((__INT_MAX__ + 1LL) / 2) != 0) | |
33 __builtin_abort (); | |
34 #endif | |
35 return 0; | |
36 } |