https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118080
anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW CC| |anlauf at gcc dot gnu.org Last reconfirmed| |2025-02-11 Ever confirmed|0 |1 --- Comment #3 from anlauf at gcc dot gnu.org --- (In reply to Tobias Burnus from comment #2) > Fortran (the spec) is quite open in terms of how it is implemented. If a > derived type (w/o allocatable components) is just passed via the stack (= > platform ABI), it will automatically create a copy, otherwise, we could > implement it by copying it (either in the caller or callee; the latter might > provide more room for optimizations in general, unless we already do copy in > on the caller side, then it's better on the caller side). > > In any case, just silently failing is not really an option … I now had a look at this, and played with variations of user-defined types, c_ptr, and c_funptr, and now agree with you. The only way to handle this is to pass a hidden argument for the presence (or absence) of the optional,value argument. There are several places which need to be checked, as not only the call is mishandled, also the fndecls are not right, and things are not consistent for the c_* types and other types. I'll have a look and see how far I get.