-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Closed
Labels
compiler-rt:tysanType sanitizerType sanitizerfalse-positiveWarning fires when it should notWarning fires when it should not
Description
Maybe I'm just not using it right, or not understanding something, but OTOH TySan is new, and thus probably a bit buggy... I used creduce to create a C test case showing, I think, a false positive.
typedef struct {
int len;
char *list;
} str_list;
typedef struct {
str_list infiles;
char command;
} nt_opts;
int add_string(str_list *slist) {
(void)(slist->list);
}
int process_opts(nt_opts *opts) {
add_string(&opts->infiles);
}
void free_opts_mem(nt_opts *nopt) {
(void)(nopt->infiles.list); // •••TySan warns here•••
}
void main(int argc, char *argv[]) {
nt_opts opts;
int rv = process_opts(&opts);
free_opts_mem(&opts);
}then I run:
(xcrun /Users/sean/llvm/llvm-install/bin/clang -w -g -fsanitize=type test.c && ./a.out)
and I get:
==4848==ERROR: TypeSanitizer: type-aliasing-violation on address 0x00016cfc71f0 (pc 0x000102e3b690 bp 0x00016cfc6ea0 sp 0x00016cfc6620 tid 24776816)
READ of size 8 at 0x00016cfc71f0 with type p1 omnipotent char (in <anonymous type> at offset 8) accesses an existing object of type p1 omnipotent char (in <anonymous type> at offset 8)
#0 0x000102e3b68c in free_opts_mem test.c:20
Aside:
- what is an "omnipotent char"?
- what is "type p1" referring to?
Metadata
Metadata
Assignees
Labels
compiler-rt:tysanType sanitizerType sanitizerfalse-positiveWarning fires when it should notWarning fires when it should not