[Bug c/59905] Unfriendly abort when calling a fucntion via a function pointer cast

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 29 11:22:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59905

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Created attachment 31977
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31977&action=edit
patch

I am testing the following.  The middle-end now properly calls a function via
the ABI as specified by the function type used for the indirect call and the
inliner refrains from inlining function with "too much" mismatch.  If that
doesn't
end up working we have to fix that (I positively believe it does work).

Btw, a workaround for you is to simply go through a temporary:

#define bar_get_x \
  ({ bar_get_x_func *f = (bar_get_x_func*) foo_get_x; f; })

that way the frontend doesn't detect the mismatch and thus simply emits
an indirect call (later optimized to a direct one).



More information about the Gcc-bugs mailing list