https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71917
--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > Sorry for the bugs, I am however tempted to say this will turn out to be a > libffi bug. You have described the same failure mode as I fixed for MIPS but > libjava is now following the ffi return type rules so my assumption is that > it is sparc ffi that is not. I've had a quick read of sparc ffi code and it > seems there is a chance that integer return types are not being promoted to > word size. I.e. following the ffi rule that integers smaller than a word are > returned as type ffi_arg. No, integer return types are of course promoted to word size as per the ABI. It looks like the issue comes from FFI_SIZEOF_ARG not being defined for SPARC, but it's not defined for many architectures as of this writing: ./tile/ffitarget.h:# define FFI_SIZEOF_ARG 8 ./tile/ffitarget.h:# define FFI_SIZEOF_ARG 4 ./mips/ffitarget.h:# define FFI_SIZEOF_ARG 4 ./mips/ffitarget.h:# define FFI_SIZEOF_ARG 8 ./x86/ffitarget.h:#define FFI_SIZEOF_ARG 8 ./x86/ffitarget.h:#define FFI_SIZEOF_ARG 8 ./aarch64/ffitarget.h:#define FFI_SIZEOF_ARG 8 so your change will probably break some others (64-bit PA comes to mind).