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

            Bug ID: 116670
           Summary: symbol X has no implicit type in associate with
                    type-bound procedures
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gronki at gmail dot com
  Target Milestone: ---

I have found a really nasty bug which makes me unable to compile my codebase in
Gfortran. Actually, I have found bug similar to mine, namely 

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

However, I have found test case which still fails, at least with gfortran 14
(but at least the problem persists since 12).

module problematic1_m
    implicit none (type, external)

    type number_t
        integer :: number
    end type

    type :: value_t
    contains
        procedure :: get_number
    end type

    contains

    elemental function get_number(value) result(number)
        class(value_t), intent(in) :: value
        type(number_t) :: number

        number%number = 5
    end function

    subroutine print_trace(value)
        type(value_t), intent(in) :: value

        ! works
        associate(item1 => get_number(value))
            print *, item1 % number
        end associate

        ! no worky
        associate(item2 => value % get_number())
            print *, item2 % number
        end associate
    end subroutine


end module problematic1_m

program test_rpoblematic
    use problematic1_m

    call print_trace(value_t())
end program

Reply via email to