pgfortran ICE with c_associated and c_loc

The following program results in an ICE with pgfortran 18.10.

  use, intrinsic :: iso_c_binding
  integer, target :: x
  print *, c_associated(c_loc(x))

Lowering Error: unknown operator for LHS or argument [ast=0,asttype=0,datatype=0]
Lowering Error: unexpected data type at load [ast=0,asttype=0,datatype=0]
PGF90-F-0000-Internal compiler error. Errors in Lowering 2 (mysource.f90: 8)
PGF90/x86-64 Linux 18.10-0: compilation aborted

x as a pointer (with or without initial target) also results in an ICE.

Thanks for the report iabpab!

I’ve recreated the error here and have filed a problem report (TPR#26716). I’ve sent it on to our compiler engineers for further investigation.

Best Regards,

It looks like this has been fixed for several releases. Sorry we didn’t notify you earlier.