Internal compiler error. Errors in Lowering

Hello. I’m using PGI Fortran 12.2 on x86_64 Ubuntu Linux.

I’m trying to compile following source, that consists of two files:

module:

module capmat
    
    real*8, allocatable, target :: CAPV(:,:),CAPVI(:,:)
    
    real :: CAPVV,CAPVVI
    pointer (pCAPVV,CAPVV(:,:))
    pointer (pCAPVVI, CAPVVI(:,:))
    
    
  contains
    subroutine capmat_init
	allocate(CAPV(10,10))
	allocate(CAPVI(10,10))

	pCAPVV = LOC(CAPV)
	pCAPVVI = LOC(CAPVI)
    End
    
End

program

      use capmat
      call capmat_init      
 
      open( 80,file='CAPMAT.dat' )
      IIUNIT=80
      WRITE(IIUNIT,*)'CAPVV'
      WRITE(IIUNIT,*)CAPVV
      WRITE(IIUNIT,*)'CAPVVI'
      WRITE(IIUNIT,*)CAPVVI
      CLOSE(80)
      END

Compiling this two files result in

pgf95 capmat_test.f95 capflt3_test.for
capmat_test.f95:
capflt3_test.for:
Lowering Error: unexpected data type at assignment [ast=64,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=72,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=77,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=80,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=83,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=91,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=93,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=96,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=99,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=101,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=105,asttype=17,datatype=0]
Lowering Error: unknown constant type for LHS or argument [ast=85,asttype=2,datatype=0]
Lowering Error: untyped operation UFUNC (type 0)
Lowering Error: unexpected data type at assignment [ast=108,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=110,asttype=17,datatype=0]
Lowering Error: unexpected data type at assignment [ast=114,asttype=17,datatype=0]
PGF90-F-0000-Internal compiler error. Errors in Lowering 16 (capflt3_test.for: 11)
PGF90/x86-64 Linux 12.2-0: compilation aborted

But if i try the same without module, in a single file, it compiles with no error.

It looks like some compiler error. Is there some workaround?

I was able to reproduce the failure and will investigate and will post what I find. Thanks for the example!

The issue is the mixing of F90 allocatables and Cray pointers. This really shouldn’t be
done. A better way would be to use F90 pointers instead of the Cray pointers. Here are the
changes needed for the capmat module that will allow this example to compile successfully.

module capmat

    real*8, allocatable, target :: CAPV(:,:),CAPVI(:,:)

    real*8, pointer :: CAPVV(:,:)
    real*8, pointer :: CAPVVI(:,:)


  contains
    subroutine capmat_init
   allocate(CAPV(10,10))
   allocate(CAPVI(10,10))

   CAPVV => CAPV
   CAPVVI => CAPVI

    End subroutine

End

I need pointers for a different types. This way i’m trying to replace old equivalence statement. Operator => doesn’t work, if CAPVV is real*8, and CAPV is real.

Cray pointers work, if used without module. I need some way to have different typed pointers, that point to the same place.

Where is the mixing? I don’t use F90 pointers in this example.

I’ve made workaround, by moving Cray pointers out of module, but i think that this compiler error should not be left without care, because there is possible situation, when moving out of module is not possible.