[Bug c/123858] wcast-function-type warning may be too strict for conversions between pointer and integer types of same width
jiangxuezhi2 at huawei dot com
gcc-bugzilla@gcc.gnu.org
Sat Jan 31 10:39:15 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123858
--- Comment #2 from Jiang XueZhi <jiangxuezhi2 at huawei dot com> ---
(In reply to Joseph S. Myers from comment #1)
> At least some m68k ABIs return pointers and integers in different registers,
> though I don't know if ABIs for any more modern processors have that
> property.
(In reply to Joseph S. Myers from comment #1)
> At least some m68k ABIs return pointers and integers in different registers,
> though I don't know if ABIs for any more modern processors have that
> property.
Thanks for your reply. in the case of m68k, the register usage differs between
pointers and registers : https://godbolt.org/z/43753deKW
I have a follow-up question: If a return type is cast from another type to
void, does this imply there is no ABI compatibility risk, and thus should not
trigger the -Wcast-function-type warning?
Example:
#include <stdio.h>
#include <stdint.h>
int a = 0;
int func() {
return a;
}
int main() {
void (*d)() = (void (*)())func;
return 0;
}
More information about the Gcc-bugs
mailing list