https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69221

--- Comment #2 from Sergei Trofimovich <slyfox at inbox dot ru> ---
(In reply to Andreas Schwab from comment #1)
> The declaration of f isn't compatible with its defintion.  A cast doesn't
> change that fact.

Correct. But is it relevant here? Cast is the only real thing gcc sees.
'void * f();' is an incomplete declaration.

Is there a way to introduce a symbol without any declaration so cast would be
only source of ABI information?

If I change 'int' to 'float' in original sample it will be compiled correctly.
    // was return 1 + ((int (*)(void))f)();
    return 1 + (int)((float (*)(void))f)();
GCC won't try to cast from %a0 but will pick %fp0:

    g:
        jsr f
        fintrz.x %fp0,%fp0
        fmove.l %fp0,%d0
        addq.l #1,%d0
        rts


I suspect gcc actually knows it can use 'int' / 'void*' interchangeaby. But on
m68k it's not true.

Reply via email to