Andres Freund <andres@anarazel.de> writes:
> ../../../../../home/andres/src/postgresql/src/backend/nodes/nodeFuncs.c:2712:6: runtime error: call to function
assign_query_collations_walkerthrough pointer to incorrect function type 'bool (*)(struct Node *, void *)'
>
/srv/dev/build/postgres/m-dev-assert-clang-sanitizer/../../../../../home/andres/src/postgresql/src/backend/parser/parse_collate.c:127:
note:assign_query_collations_walker defined here
> #0 0x55c8ee0ffbd8 in query_tree_walker_impl
/srv/dev/build/postgres/m-dev-assert-clang-sanitizer/../../../../../home/andres/src/postgresql/src/backend/nodes/nodeFuncs.c:2712:6
Ugh. So they're enforcing the C standard's position that "void *" is
not compatible with anything else. That makes this check useless to
us. We already decided that we're not going to take the hit of
declaring all walker/mutator callbacks with "void *", and I don't see
that this tool changes that decision.
> On https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html I found
> -fsanitize=function, which also can be used as -fno-sanitize=function:
>> -fsanitize=function: Indirect call of a function through a function pointer of the wrong type.
> With that I can get past this issue.
Good.
> I wish the sanitizer treated mismatches of void * arguments against a "real
> type" different from other mismatches, but ...
Indeed. I think we have enough coverage of that via compile-time
checks, though -- it's not like the type match or mismatch will vary
dynamically.
regards, tom lane