Problem Allocating Logical from Class(*) using Source in Fortran

Is the following valid Fortran

    Program LogicalAllocation
        class(*), pointer :: bool

        allocate(bool, source=.false.)
        select type(bool)
        type is (logical)
            Print *, bool
        end select
    End Program LogicalAllocation

On my intel fortran oneapi version 2023.0.0.25839 this code will print 'T' or 'F' seemingly at random.


  • For future visitors. It should be valid Fortran syntax, and it seems to be a compiler bug.