[Bug fortran/67674] Incorrect result or ICE for deferred-length character component

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Sep 21 23:35:00 GMT 2015


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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-09-21
                 CC|                            |kargl at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from kargl at gcc dot gnu.org ---
Reduced testcase.

! { dg-do run }
! PR fortran/67674
!
program test

   implicit none

   type str_t
      character(len=:), allocatable :: name
   end type str_t

   type(str_t) s

! This actually does what one expects.
!   character(len=:), allocatable :: a
!   allocate(character(len=0) :: a)
!   if (len(a) /= 0) call abort
!   call word(a)
!   if (len(a) /= 28) call abort

   allocate(character(len=0) :: s%name)
   if (len(s%name) /= 0) call abort
   call word(s%name)
   if (len(s%name) /= 28) call abort

   contains

      subroutine word(s1)
         character(len=:), allocatable :: s1
          s1 = 'here the word is finally set'
      end subroutine word

end program test



More information about the Gcc-bugs mailing list