ICE Lowering Error with IPA

I’m pretty sure this code violates a constraint on equivalence in the Fortran standard, but you could say any ICE is a bug, so I wanted to bring it to your attention. I realize I’m using an old version of pgf90, so perhaps this issue has been fixed (i.e., error message instead of ICE) in the latest release.

% pgf90 -V

pgf90 8.0-5 64-bit target on x86-64 Linux -tp core2-64
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2009, STMicroelectronics, Inc.  All Rights Reserved.



% cat bug.f90
module moda
  integer, parameter :: c1 = 203, c2 = 16, c3 = 16, c4 = 7, c5 = 140
  integer, parameter :: c6 = 10, c7 = 14, c8 = 12, c9 = 6, c10 = 8
  integer, parameter :: c11 = 4, c12 = 2, c13 = 22, c14 = 38, c15 = 52
  integer, parameter :: c16 = 68, c17 = 76, c18 = 88, c19 = 96
  integer, parameter :: c20 = 108, c21 = 114, c23 = 122, c24 = 130
  integer, parameter :: c25 = 134, c26 = 136, c27 = 138
end module moda

module modb
  integer, parameter :: c6 = 10
  real :: mbv1(c6), mbv2(c6), mbv3(5,13,c6), mbv4(65,c6)
  real :: mbv5(5,13:59,c6), mbv6(235,c6), mbv7(19,c6), mbv8(19,c6)
  real :: mbv9(10,c6), mbv10(4,c6)
  equivalence (mbv3(1,1,1),mbv4(1,1)), (mbv5(1,13,1),mbv6(1,1))
end module modb

module modc
  use moda, only : c2, c3
  integer :: mcv1(c3)
  real :: mcv2(181)
  real :: mcv3(c3*c2)
end module modc

module modd
  use modc, only: mcv1
  implicit none
contains
  subroutine sub1(s1arg)
    real, intent(out) :: s1arg(:,:)
    call sub1sub
  contains
    subroutine sub1sub
      use moda, only : c6
      use modb, only : mbv3, mbv4, mbv5, mbv6, mbv7, mbv8, mbv9, mbv10
      integer :: i, j, k
      do i = 1, 100
         j = 2
         do k = 1, c6
            s1arg(i,k) = mbv4(j,k)
         end do
      end do
      print *, s1arg
    end subroutine sub1sub
  end subroutine sub1
end module modd

module mode
  use modd, only: sub1
  implicit none
contains
  subroutine sub2(s2arg)
    use moda, only : c5
    integer, intent(in) :: s2arg
    real :: x(s2arg+1,c5)
    call sub1(x)
  end subroutine sub2
end module mode

module modf
  use mode, only: sub2
  implicit none
contains
  subroutine sub3()
    call sub2(100)
  end subroutine sub3
end module modf

program ipa_bug
  use modf

  call sub3
end program ipa_bug



% pgf90 -fast -Mipa=fast -o bug bug.f90
IPA: Recompiling bug.o: new IPA information
Lowering Error: unexpected symbol type alias(23)
Lowering Error: unexpected symbol type alias(23)
Lowering Error: unexpected symbol type alias(23)
Lowering Error: unexpected symbol type alias(23)
PGF90-F-0000-Internal compiler error. Errors in Lowering       4 (bug.f90: 37)
PGF90/x86-64 Linux 8.0-5: compilation aborted
child process exit status 2: /usr/local/pgilinux-805/linux86-64/8.0-5/bin/pgf90

– Steve

Thanks rusteve. The good news is that it we have fixed the ICE in the 2011 release.

% pgf90 -Mipa=fast bug.f90 -V10.9
IPA: Recompiling bug.o: stale object file
Lowering Error: unexpected symbol type alias(23)
Lowering Error: unexpected symbol type alias(23)
Lowering Error: unexpected symbol type alias(23)
Lowering Error: unexpected symbol type alias(23)
PGF90-F-0000-Internal compiler error. Errors in Lowering       4 (STDIN.f: 37)
PGF90/x86-64 Linux 10.9-0: compilation aborted
%
% pgf90 -Mipa=fast bug.f90 -V11.0
IPA: Recompiling bug.o: stale object file
  • Mat