| 1 |
/* Verify we don't ICE generating out-of-bounds diagram. */ |
| 2 |
|
| 3 |
/* { dg-additional-options "-O0 -fdiagnostics-text-art-charset=unicode" } */ |
| 4 |
|
| 5 |
#include <stdio.h> |
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
uint64_t d(int32_t h) { |
| 9 |
uint64_t j[2][6]; |
| 10 |
int32_t k; |
| 11 |
for (k = 1;;) { |
| 12 |
printf("FLAG\n"); |
| 13 |
if (h < 106 || j[k][h]) /* { dg-warning "stack-based buffer over-read" } */ |
| 14 |
return 0; |
| 15 |
} |
| 16 |
} |
| 17 |
int16_t e() { |
| 18 |
int32_t f[5]; |
| 19 |
for (f[2] = 3; f[2]; --f[2]) |
| 20 |
d(0); |
| 21 |
} |
| 22 |
|
| 23 |
int main() { e(); } |
| 24 |
|
| 25 |
/* We don't care about the exact diagram, just that we don't ICE. */ |
| 26 |
|
| 27 |
/* { dg-allow-blank-lines-in-output 1 } */ |
| 28 |
/* { dg-prune-output ".*" } */ |