You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ gcc -Wall -fsanitize=undefined tst.c
$ ./a.out
$ clang -Wall -fsanitize=undefined tst.c
$ ./a.out
tst.c:15:9: runtime error: call to function _a_1 through pointer to incorrect function type 'int (*)(char *, void *, struct svc_req *)'
tst.c: note: _a_1 defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior tst.c:15:9
As can be seen, only clang complained.
I don't know if it is a real UB or a false-positive.
But as gcc keeps silence, I assume this is
a false-positive.
There is no way to "just fix" the code, as it
is generated by rpcgen.
The text was updated successfully, but these errors were encountered:
I think UBSan is correct: _a_1 is defined with a char ** as its first argument, but the call is done with a char * as its first argument. Does the runtime error go away if you fix that?
It does, but if, for example, I change char ** to void * in _a_1, then error
does NOT disappear.
So its not like clang's ubsan wants the
proper pointer indirection, no, it wants
the precise type match. Even void *
doesn't match to char *.
It appears, clang's ubsan complains on
an rpcgen-generated code, while gcc's
ubsan is silent.
The code roughly looks like this (reduced test-case):
Now do this:
As can be seen, only clang complained.
I don't know if it is a real UB or a false-positive.
But as gcc keeps silence, I assume this is
a false-positive.
There is no way to "just fix" the code, as it
is generated by rpcgen.
The text was updated successfully, but these errors were encountered: