view gcc/testsuite/gcc.dg/analyzer/pr93382.c @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 1830386684a0
children
line wrap: on
line source

typedef __SIZE_TYPE__ size_t;

int idx;
void *fp;

size_t
fread (void *, size_t, size_t, void *);

void
ql (void)
{
  int n1[1];

  fread (n1, sizeof (n1[0]), 1, fp); /* { dg-message "'n1' gets an unchecked value here" } */
  idx = n1[0]; /* { dg-message "'idx' has an unchecked value here (from 'n1')" */
}

int arr[10];
	
int
pl (void)
{
  ql ();
  return arr[idx]; /* { dg-warning "use of tainted value 'idx' in array lookup without bounds checking" } */
}