[Bug fortran/83224] creating character array from elements shorter than declared does not pad with whitespace properly and aborts

dominiq at lps dot ens.fr gcc-bugzilla@gcc.gnu.org
Thu Nov 30 09:58:00 GMT 2017


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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-11-30
             Blocks|                            |68241
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from 5.5.0 up to trunk.

With the reduced test case

program dusty_corner ! exercise f2008 CHARACTER features
implicit none
character(len=:),allocatable :: words(:)
character(len=:),allocatable :: words1(:), words2(:)

words1=[character(len=3) :: 'one', 'two']
words2=[character(len=5) :: words1, 'three']
write(*,'(5("[",a,"]":))')words2

words=[character(len=3) :: 'one', 'two']
words=[character(len=5) :: words, 'three']
write(*,'(5("[",a,"]":))')words

end program dusty_corner

I get

[one  ][two  ][three]
[onetw][twoth][three]

The problem comes from using 'words' in both sides of the assignment.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68241
[Bug 68241] [meta-bug] [F03] Deferred-length character


More information about the Gcc-bugs mailing list