-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Labels
compiler-rt:tysanType sanitizerType sanitizer
Description
Trying out #76261, this program with a variadic function:
#include <stdarg.h>
#include <stdio.h>
void foo(void) {
long array[64];
for (int i = 0; i < 64; ++i) {
array[i] = i;
}
printf("%p\n", array);
}
void bar(int first, ...) {
va_list args;
va_start(args, first);
va_arg(args, char *);
va_end(args);
}
int main(void) {
foo();
bar(0, "");
}
Gives a strange report:
tavianator@tachyon $ ~/code/llvm/llvm-project/build/bin/clang -g -fsanitize=type foo.c -o foo
tavianator@tachyon $ ./foo
0x7ffd254f1130
==231524==ERROR: TypeSanitizer: type-aliasing-violation on address 0x7ffd254f1268 (pc 0x55b385ac9008 bp 0x7ffd254f1170 sp 0x7ffd254f1110 tid 231524)
READ of size 8 at 0x7ffd254f1268 with type any pointer accesses an existing object of type long
#0 0x55b385ac9007 in bar /home/tavianator/code/bfs/foo.c:15:2
CC: @gbMattN
Metadata
Metadata
Assignees
Labels
compiler-rt:tysanType sanitizerType sanitizer