Re:C, Fortran, and single-character strings
by shakna on Saturday June 22, 2019 @11:00AM
(#20249941)
> By generating c code that correctly sets memory to call a function with a particular ABI with the given signature.
And it does. The signature is wrong, however, and so the resulting call will be wrong.
Since the standard doesn't speak about FFI, and the invalid call is actually in another language's memory, I'd say we're in completely undefined territory here.
To try and say that more clearly, I'd still call it undefined behaviour if an invalid type signature in Java calling Go resulted in something going wrong. Java can't know how Go is supposed to react to a fudge in it's internal memory semantics.
Since the spec doesn't speak about FFI at all it seems, I think this is implementation defined behavior, not undefined behavior.