https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66089

--- Comment #25 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I've come to a bit of a different conclusion.

For

module x
implicit none
contains
  elemental subroutine foo(a,b)
  real, intent(inout) :: a                                                      
  real, intent(in), optional :: b                                               
  if (present(b)) a = a + b                                                     
  end subroutine foo                                                            
end module x                                                                    

program main                                                                    
  use x                                                                         
  real :: a(10)                                                                 
  a = 1.                                                                        
  call foo(a)                                                                   
  print *,a                                                                     
end program main

we (I think correctly) generate

{
  if (b != 0B)
    {
      *a = *a + *b;
    }
  L.1:;
}

Reply via email to