https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93814
--- Comment #15 from Christopher Albert <albert at tugraz dot at> --- Created attachment 64105 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64105&action=edit Proposed patch: fix ICE in build_entry_thunks with CHARACTER bind(c) ENTRY Patch to fix the segfault in build_entry_thunks (PR93814). When a function with bind(c) has a CHARACTER result and an ENTRY also with bind(c), the entry thunk returns CHARACTER(1) by value but the master function returns by reference. build_entry_thunks assumed thunks always share the master's calling convention, accessing DECL_ARGUMENTS on a thunk with no reference arguments, causing the segfault. The fix detects the ABI mismatch (master returns by reference, thunk does not) and creates local temporaries for the result buffer and string length to pass to the master call. After the master writes to the buffer, the thunk loads the character value and returns it by value. Covers all four combinations: both bind(c), neither, function-only, entry-only. Bootstrapped and regtested on x86_64-pc-linux-gnu, no regressions.
