https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71498
Bug ID: 71498
Summary: ubsan bounds checking influenced by surrounding code
Product: gcc
Version: 5.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
Target Milestone: ---
$ gcc -c /tmp/test.c -o - -S -fsanitize=bounds |grep ubsan_handle
call __ubsan_handle_out_of_bounds
$ gcc -c /tmp/test.c -o - -S -fsanitize=bounds |grep ubsan_handle
$
int a[100];
extern void call(const char * fn);
int testje (int core)
{
#if 1
// OK
call("har har");
#else
// NOK
call(__FUNCTION__);
#endif
return a[core];
}