PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

ICE Lowering Error with Derived Type

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
rusteve



Joined: 21 Jun 2007
Posts: 14

PostPosted: Tue Jun 30, 2009 11:30 am    Post subject: ICE Lowering Error with Derived Type Reply with quote

I'm curious if the following works with the latest version:
Code:
% cat lowerror.f90
module low_mod
  implicit none
  private
  public :: vd
  public :: assignment(=)
  public :: operator(-), operator(/)

  integer, parameter :: NMax = 19, r8 = selected_real_kind(15,100)

  type vd
     real(r8) :: value
     real(r8) :: deriv(NMax)
     integer  :: ind(NMax)
     integer  :: nderiv = -1
  end type vd

  interface assignment(=)
     module procedure nv1, nvi
  end interface
  interface operator(-)
     module procedure vmv
  end interface

contains

  pure subroutine ad(r,n,ind)
    type(vd), intent(out) :: r
    integer,  intent(in)  :: n
    integer,  intent(in)  :: ind(:)
    r%nderiv=n
    if (n > 0) then
       r%ind(1:n)=ind(1:n)
       r%deriv(1:n)=0._r8
    end if
  end subroutine ad

  elemental subroutine mv(v1,v2)
    type(vd), intent(inout) :: v1
    type(vd), intent(in)    :: v2
    type(vd) :: r
    integer :: n, i, j
    call nv2(r,v1,v2)
    n = r%nderiv
    r%deriv(1:n) = 0._r8
    r%value = v1%value - v2%value
    j = 0
    do i = 1, v1%nderiv
       do j = j+1, n
          if (v1%ind(i) == r%ind(j)) then
             r%deriv(j) = v1%deriv(i)
             exit
          end if
       end do
    end do
    j = 0
    do i = 1, v2%nderiv
       do j = j+1, n
          if(v2%ind(i) == r%ind(j)) then
             r%deriv(j) = r%deriv(j) - v2%deriv(i)
             exit
          end if
       end do
    end do
    call nv1(v1,r)
  end subroutine mv

  elemental subroutine nv1(r,v)
    type(vd), intent(out) :: r
    type(vd), intent(in)  :: v
    call ad(r,v%nderiv,v%ind)
    r%value = v%value
    r%deriv(1:r%nderiv) = v%deriv(1:v%nderiv)
  end subroutine nv1

  elemental subroutine nv2(r,v1,v2)
    type(vd), intent(out) :: r
    type(vd), intent(in)  :: v1, v2
    integer :: n, i1, i2, n1, n2
    integer, allocatable :: itab(:)
    n1 = v1%nderiv
    n2 = v2%nderiv
    allocate(itab(n1+n2))
    n = 0
    i1 = 1
    i2 = 1
    do
       if (i1 > n1) then
          itab(n+1:n+1+n2-i2) = v2%ind(i2:n2)
          n = n + 1+n2-i2
          exit
       else if (i2 > n2) then
          itab(n+1:n+1+n1-i1) = v1%ind(i1:n1)
          n = n + 1+n1-i1
          exit
       else if (v1%ind(i1) == v2%ind(i2)) then
          n = n + 1
          itab(n) = v1%ind(i1)
          i1 = i1 + 1
          i2 = i2 + 1
       else if (v1%ind(i1) < v2%ind(i2)) then
          n = n + 1
          itab(n) = v1%ind(i1)
          i1 = i1 + 1
       else
          n = n + 1
          itab(n) = v2%ind(i2)
          i2 = i2 + 1
       end if
    end do
    call ad(r,n,itab)
    deallocate(itab)
  end subroutine nv2

  elemental subroutine nvi(r,c)
    type(vd), intent(out) :: r
    integer,  intent(in)  :: c
    call ad(r,0,(/0/))
    r%value = c
  end subroutine nvi

  elemental function vmv(v1,v2) result(r)
    type(vd), intent(in) :: v1,v2
    type(vd) :: r
    call nv1(r,v1)
    call mv(r,v2)
  end function vmv
end module low_mod

program lowerror
  use low_mod
  implicit none

  call vdtest(1000)

contains

  subroutine vdtest(nx)
    integer, intent(in) :: nx

    type(vd), allocatable :: p(:), v(:)

    allocate(p(nx),v(nx-1))
    p = 0
    v = p(1:nx-1) - p(2:nx)
  end subroutine vdtest
end program lowerror

% pgf95 -o lowerror lowerror.f90
Lowering Error: array upper bound is not a symbol for datatype 54
Lowering Error: array extnt is not a symbol for datatype 54
PGF90-F-0000-Internal compiler error. Errors in Lowering       2 (lowerror.f90: 145)
PGF90/x86-64 Linux 8.0-5: compilation aborted

% pgf95 -V
pgf95 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.
Back to top
View user's profile
hongyon



Joined: 19 Jul 2004
Posts: 551

PostPosted: Tue Jun 30, 2009 12:18 pm    Post subject: Reply with quote

Hi,

This works with 9.0-1. Please try.

Hongyon
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group