[Bug fortran/103942] New: [10 Regression] invalid memory reference with allocatable string and class(*)

antony at cosmologist dot info gcc-bugzilla@gcc.gnu.org
Fri Jan 7 15:43:35 GMT 2022


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

            Bug ID: 103942
           Summary: [10 Regression] invalid memory reference with
                    allocatable string and class(*)
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: antony at cosmologist dot info
  Target Milestone: ---

The code works as expected in 9.3.1 20200614. In 10.3.1 20220107 and trunk it
gives

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.



    program tester

    character(LEN=:), allocatable :: S

    S = 'CMB'
    call TT(trim(S))

    contains

    subroutine TT(S)
    class(*), intent(in) :: S
    class(*), allocatable :: S2

    allocate(S2, source=S)

    end subroutine TT


    end program tester


More information about the Gcc-bugs mailing list