| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-additional-options "-O3" } */ |
| 3 |
/* { dg-additional-options "-march=haswell" { target x86_64-*-* i?86-*-* } } */ |
| 4 |
|
| 5 |
int crash_me(char* ptr, unsigned long size) |
| 6 |
{ |
| 7 |
short result[16] = {0}; |
| 8 |
|
| 9 |
unsigned long no_iters = 0; |
| 10 |
for(unsigned long i = 0; i < size - 12; i+= 13){ |
| 11 |
for(unsigned long j = 0; j < 12; j++){ |
| 12 |
result[j] += ptr[i + j] - '0'; |
| 13 |
} |
| 14 |
no_iters++; |
| 15 |
} |
| 16 |
|
| 17 |
int result_int = 0; |
| 18 |
for(int j = 0; j < 12; j++){ |
| 19 |
int bit_value = result[j] > no_iters/2 ? 1 : 0; |
| 20 |
result_int |= bit_value; |
| 21 |
} |
| 22 |
|
| 23 |
return result_int; |
| 24 |
} |