http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57090



             Bug #: 57090

           Summary: FAIL: gfortran.dg/alloc_comp_bounds_1.f90  -O*

                    execution test

    Classification: Unclassified

           Product: gcc

           Version: fortran-dev

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: fortran

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: domi...@lps.ens.fr

                CC: bur...@gcc.gnu.org





The test gfortran.dg/alloc_comp_bounds_1.f90 fails when compile with the

fortran-dev branch. Reduced test:



  integer, parameter :: ik4 = 4

  integer, parameter :: ik8 = 8

  integer, parameter :: from = -1, to = 2

  call foo

  call bar

contains

  subroutine foo

    type :: struct

      integer(4), allocatable :: ib(:)

    end type struct

    integer(ik4), allocatable :: ia(:)

    type(struct) :: x

    allocate(ia(from:to))

    x=struct(ia(:))

    print *, lbound(x%ib), ubound(x%ib), "  expected  1 4"

!    if (any(lbound(x%ib) .ne. 1) .or. any(ubound(x%ib) .ne. 4)) call abort

    deallocate(ia)

  end subroutine

  subroutine bar

    type :: struct

      integer(4), allocatable :: ib(:)

    end type struct

    integer(ik8), allocatable :: ia(:)

    type(struct) :: x

    allocate(ia(from:to))

    x=struct(ia)

    print *, lbound(x%ib), ubound(x%ib), "  expected -1 2"

!    if (any(lbound(x%ib) .ne. -1) .or. any(ubound(x%ib) .ne. 2)) call abort

    x=struct(ia(:))

    print *, lbound(x%ib), ubound(x%ib), "  expected  1 4"

!    if (any(lbound(x%ib) .ne. 1) .or. any(ubound(x%ib) .ne. 4)) call abort

    x=struct(ia(from:to))

    print *, lbound(x%ib), ubound(x%ib), "  expected  1 4"

!    if (any(lbound(x%ib) .ne. 1) .or. any(ubound(x%ib) .ne. 4)) call abort

    deallocate(ia)

  end subroutine

end



output



           1           6   expected  1 4

          -1           1   expected -1 2

           1           5   expected  1 4

           1           5   expected  1 4

Reply via email to