More fold_negate in match.pd
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / forwprop-29.c
blob73cf79904b7630a801948ec6fe7a081aae60a94c
1 /* { dg-options "-O2 -fno-ipa-icf" } */
3 void runtime_error (void) __attribute__ ((noreturn));
4 void compiletime_error (void) __attribute__ ((noreturn, error ("")));
6 static void
7 compiletime_check_equals_1 (int *x, int y)
9 int __p = *x != y;
10 if (__builtin_constant_p (__p) && __p)
11 compiletime_error ();
12 if (__p)
13 runtime_error ();
16 static void
17 compiletime_check_equals_2 (int *x, int y)
19 int __p = *x != y;
20 if (__builtin_constant_p (__p) && __p)
21 compiletime_error (); /* { dg-error "call to" } */
22 if (__p)
23 runtime_error ();
26 void
27 foo (int *x)
29 compiletime_check_equals_1 (x, 5);
30 compiletime_check_equals_2 (x, 10);