public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/67977] New: allocatable strings, array section reallocated - non-standard behaviour
@ 2015-10-15 18:55 mexas at bristol dot ac.uk
  2015-10-16  8:51 ` [Bug fortran/67977] " dominiq at lps dot ens.fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mexas at bristol dot ac.uk @ 2015-10-15 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 67977
           Summary: allocatable strings, array section reallocated -
                    non-standard behaviour
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mexas at bristol dot ac.uk
  Target Milestone: ---

character(:), allocatable :: z
z = "cockatoo"
write (*,*) z, len(z)
z(:) = ''
write (*,*) z, len(z)
end

with gfortran 4.9 to 6.0 this returns:

 cockatoo           8
            0

which is wrong. It should return:

 cockatoo           8
                    8

i.e. the length of variable "z" must not change
from the second assignment statement. This is because
the array section is used ( z(:) ), which should not
trigger reallocation. So "z" after the second assignment
must still be 8 characters long, all blanks.

Anton


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-26 17:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-15 18:55 [Bug fortran/67977] New: allocatable strings, array section reallocated - non-standard behaviour mexas at bristol dot ac.uk
2015-10-16  8:51 ` [Bug fortran/67977] " dominiq at lps dot ens.fr
2015-10-18  9:32 ` pault at gcc dot gnu.org
2015-10-18 12:28 ` pault at gcc dot gnu.org
2015-10-19 11:42 ` davidgkinniburgh at yahoo dot co.uk
2015-10-19 12:25 ` paul.richard.thomas at gmail dot com
2015-10-26 17:25 ` pault at gcc dot gnu.org
2015-10-26 17:27 ` pault at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).