1 /* { dg-options "-O2 -fno-ipa-icf" } */
2 
3 void runtime_error (void) __attribute__ ((noreturn));
4 void compiletime_error (void) __attribute__ ((noreturn, error ("")));
5 
6 static void
compiletime_check_equals_1(int * x,int y)7 compiletime_check_equals_1 (int *x, int y)
8 {
9   int __p = *x != y;
10   if (__builtin_constant_p (__p) && __p)
11     compiletime_error ();
12   if (__p)
13     runtime_error ();
14 }
15 
16 static void
compiletime_check_equals_2(int * x,int y)17 compiletime_check_equals_2 (int *x, int y)
18 {
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 ();
24 }
25 
26 void
foo(int * x)27 foo (int *x)
28 {
29   compiletime_check_equals_1 (x, 5);
30   compiletime_check_equals_2 (x, 10);
31 }
32