Character allocatable component is truncated

Hello. I am using:

$ nvfortran --version
nvfortran 21.9-0 64-bit target on x86-64 Linux -tp zen 
NVIDIA Compilers and Tools

Here is my test code:

$ cat test_create_single.f90
program test_create_single
  implicit none
  character(len = :), allocatable:: attr_name(:)
  type coord_def
     character(len = :), allocatable:: attr_name(:)
  end type coord_def
  type(coord_def) coordinates
  attr_name = ["units"]
  print *, 'attr_name: "', attr_name, '"'
  coordinates%attr_name = attr_name
  print *, 'coordinates%attr_name: "', coordinates%attr_name, '"'
end program test_create_single

When I compile and run it, I get:

$ nvfortran test_create_single.f90
$ a.out
 attr_name: "units"
 coordinates%attr_name: "un"

I should get:

 coordinates%attr_name: "units"

I think this is a compiler bug. Would you correct this?
Sincerely.

Hi guez,

This looks to be a known issue. While it still fails in our current 23.5, I checked against our pre-release 23.7, which will be available soon, and it appears to be corrected.

Given 23.7 is pre-release, I can’t guarantee that the fix will be in the final release, sometimes things get pulled, but it’s likely to be there.

-Mat

OK, thank you.