https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67564

--- Comment #9 from neil.n.carlson at gmail dot com ---
I confirm that my original example now runs without error with the current
6-branch.  However this variation, where the allocated unlimited polymorphic
variable is passed back as a return argument, is not working correctly.

class(*), allocatable :: val(:)
call get_value (val)
select type (val)
type is (character(*))
  print *, 'size(val)=', size(val)
  print *, 'len(val)=', len(val)
  print *, 'val=', val
end select
contains
  subroutine get_value (value)
    class(*), allocatable, intent(out) :: value(:)
    allocate(value, source=['foo','bar'])
  end subroutine
end

Here is the output from running the compiled program:
 size(val)=           2
 len(val)=           0
 val=

The length of the character variable should be 3.  I don't think the problem is
as simple as the length not being assigned properly.  In my actual use case
(much more complicated) attempting to print "val" results in a segmentation
fault.

Reply via email to