| 1 |
int |
| 2 |
foo (int a) |
| 3 |
{ |
| 4 |
int b = a == 0; |
| 5 |
return (a & b); |
| 6 |
} |
| 7 |
|
| 8 |
#define function(vol,cst) \ |
| 9 |
__attribute__((noipa)) \ |
| 10 |
_Bool func_##cst##_##vol(vol int a) \ |
| 11 |
{ \ |
| 12 |
vol int b = a == cst; \ |
| 13 |
return (a & b); \ |
| 14 |
} |
| 15 |
|
| 16 |
#define funcdefs(cst) \ |
| 17 |
function(,cst) \ |
| 18 |
function(volatile,cst) |
| 19 |
|
| 20 |
#define funcs(f) \ |
| 21 |
f(0) \ |
| 22 |
f(1) \ |
| 23 |
f(5) |
| 24 |
|
| 25 |
funcs(funcdefs) |
| 26 |
|
| 27 |
#define test(cst) \ |
| 28 |
do { \ |
| 29 |
if(func_##cst##_(a) != func_##cst##_volatile(a))\ |
| 30 |
__builtin_abort(); \ |
| 31 |
} while(0); |
| 32 |
int main(void) |
| 33 |
{ |
| 34 |
for(int a = -10; a <= 10; a++) |
| 35 |
{ |
| 36 |
funcs(test) |
| 37 |
} |
| 38 |
} |
| 39 |
|