1 /* PR target/29776 */
2 /* PR tree-optimization/61725 */
3 /* { dg-do compile } */
4 /* { dg-options "-O2 -fdump-tree-vrp1" } */
5 /* { dg-final { scan-tree-dump-not "link_error" "vrp1"} } */
6 
7 #define A(fn, arg, min, max) \
8   if (__builtin_##fn (arg) < min || __builtin_##fn (arg) > max) \
9     link_error ();
10 #define B(fn, min, max) \
11   A (fn, a, min, max) A (fn##l, b, min, max) A (fn##ll, c, min, max)
12 #define C(fn, min, sub) \
13   A (fn, a, min, ((int) sizeof (a) * __CHAR_BIT__ - sub)) \
14   A (fn##l, b, min, ((int) sizeof (b) * __CHAR_BIT__ - sub)) \
15   A (fn##ll, c, min, ((int) sizeof (c) * __CHAR_BIT__ - sub))
16 
17 extern void link_error (void);
18 
19 unsigned int d;
20 unsigned long e;
21 unsigned long long f;
22 
23 void
foo(int a,long b,long long c)24 foo (int a, long b, long long c)
25 {
26   C (ffs, 0, 0)
27   a &= 63; b &= 63; c &= 63;
28   B (ffs, 0, 6)
29   a++; b++; c++;
30   B (ffs, 1, 7)
31   a -= 2; b -= 2; c -= 2;
32   C (ffs, 0, 0)
33   a -= 63; b -= 63; c -= 63;
34   C (ffs, 1, 0)
35 }
36