[RISC-V] Avoid unnecessary extensions when value is already extended
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / taint-realloc.c
blobd5ccb28ddd2807f96702d88ba22ccd46fee9068f
1 /* { dg-skip-if "requires hosted libstdc++ for stdlib realloc" { ! hostedlib } } */
3 #include "analyzer-decls.h"
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
8 /* realloc with tainted size. */
10 void *p;
12 void __attribute__((tainted_args))
13 test_1 (size_t sz) /* { dg-message "\\(1\\) function 'test_1' marked with '__attribute__\\(\\(tainted_args\\)\\)'" } */
15 void *q;
17 __analyzer_dump_state ("taint", sz); /* { dg-warning "state: 'tainted'" } */
19 q = realloc (p, sz); /* { dg-warning "use of attacker-controlled value 'sz' as allocation size without upper-bounds checking" } */
20 } /* { dg-warning "leak of 'q'" } */