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;
}

Reply via email to