aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-pr110928.c
blob: a0164c9d046574d65e33129fa92b4fcb874d202c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Verify we don't ICE generating out-of-bounds diagram.  */

/* { dg-additional-options "-O0 -fdiagnostics-text-art-charset=unicode" } */

#include <stdio.h>
#include <stdint.h>

uint64_t d(int32_t h) {
  uint64_t j[2][6];
  int32_t k;
  for (k = 1;;) {
    printf("FLAG\n");
    if (h < 106 || j[k][h]) /* { dg-warning "stack-based buffer over-read" } */
      return 0;
  }
}
int16_t e() {
  int32_t f[5];
  for (f[2] = 3; f[2]; --f[2])
    d(0);
}

int main() { e(); }

/* We don't care about the exact diagram, just that we don't ICE.  */

/* { dg-allow-blank-lines-in-output 1 } */
/* { dg-prune-output ".*" } */