https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117302
kargls at comcast dot net changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kargls at comcast dot net --- Comment #1 from kargls at comcast dot net --- (In reply to Igor S Gerasimov from comment #0) > Hi! > > With the following code, GCC generates wrong code: > > > real(8) function test1(a) result(r) > implicit none > real(8), intent(in), optional :: a > r = merge(a, 1.0_8, present(a)) > end function test1 The code is invalid Fortran. gfortran can produce anything including what you think is the "right" behavior. This should be closed with INVALID.