String length lost on assignment to DT with deferred length string

The following code misbehaves with nvfortran-21.7:

program p
type t
character(:), allocatable :: c(:)
end type
character(len=8) :: a(2) = ‘12 45 78’
type(t) :: x
x%c = a
print *, x%c(1)(7:8) ! expect: 78
print *, x%c ! expect: 12 45 7812 45 78
print *, len (x%c) ! expect: 8
print *, size (x%c) ! expect: 2
end

With nvfortran-21.7 I get:

1212
2
2

while Intel and gfortran both give:

78
12 45 7812 45 78
8
2

which appears correct.

Thanks anlauf, this look similar to a known issue where the wrong string length for a character array within a derived type is printed. Though, your example is a bit different, so I filled a new report, TPR #30534, and sent it engineering for review.

-Mat