Bad class(*) allocation with character array source

The following example produces incorrect results with 18.4

class(*), allocatable :: x(:)
allocate(x, source=['foo','bar'])  ! SOMETHING GOES WRONG HERE
select type (x)
type is (character(*))
  print '(''["'',a,''","'',a,''"]'')', x ! expect ["foo","bar"]
  if (len(x) /= 3) stop 11
  if (size(x) /= 2) stop 12
  if (any(x /= ['foo','bar'])) stop 13  ! EXITS HERE
class default
  stop 10
end select
end

The expected result is

[“foo”,“bar”]

but pgfortran gives

$ pgfortran pgi-src-alloc-2.f90
$ ./a.out
[“fo”,“”]
13

Hi NeilC,

I was able to reproduce this issue here and have created TPR#25698 and sent to engineering for further investigation.

Thanks!
Mat

Issue has been fixed since 18.7. Should now print out

[“foo”,“bar”]

as expected