aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr111266.c
blob: cee36630baa20c5aa9fb7a913de53120f2ea7814 (plain)
1
2
3
4
5
6
7
8
9
10
11
#include <stdint.h>
void *malloc (__SIZE_TYPE__);
void free (void *);

void test_binop2 ()
{
  char *p = (char *) malloc (4);
  int32_t *i = (int32_t *) (p + 3);
  *i = 20042; /* { dg-warning "heap-based buffer overflow" } */
  free (p);
}