[Bug fortran/78054] gfortran.dg/pr70673.f90 FAILs at -O0

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 26 17:03:59 GMT 2022


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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #4 from kargl at gcc dot gnu.org ---
(In reply to Hans-Peter Nilsson from comment #3)
> Now also failing execution at -O0 on cris-elf and apparently
> s390x-ibm-linux-gnu since r12-8227-g89ca0fffa48b79.

The code is clearly invalid Fortran.

module m
contains
  subroutine s(inp)
    character(*), intent(in) :: inp
    character(:), allocatable :: a

    a = a           ! This used to ICE.
!
! The above is an invalid reference of an unallocated allocatable on
! the RHS.
!
    a = inp
    a = a           ! This used to ICE too
    if ((len (a) .ne. 5) .or. (a .ne. "hello")) STOP 1
    a = a(2:3)      ! Make sure that temporary creation is not broken.
    if ((len (a) .ne. 2) .or. (a .ne. "el")) STOP 2
    deallocate (a)
    a = a           ! This would ICE too.
!
! The above is an invalid reference of an unallocated allocatable on
! the RHS.
!
  end subroutine s
end module m

  use m
  call s("hello")
end

You either need to remove the above two lines to get a valid program
or remove the testcase as it's testing processor dependent behavior.


More information about the Gcc-bugs mailing list