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
* [Bug fortran/67977] allocatable strings, array section reallocated - non-standard behaviour
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 ` dominiq at lps dot ens.fr
2015-10-18 9:32 ` pault at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-10-16 8:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67977
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-10-16
CC| |pault at gcc dot gnu.org
Ever confirmed|0 |1
Known to fail| |4.8.5, 4.9.3, 5.2.0, 6.0
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from 4.8 up to trunk (6.0).
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/67977] allocatable strings, array section reallocated - non-standard behaviour
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
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu.org @ 2015-10-18 9:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67977
--- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> ---
Author: pault
Date: Sun Oct 18 09:31:21 2015
New Revision: 228940
URL: https://gcc.gnu.org/viewcvs?rev=228940&root=gcc&view=rev
Log:
2015-10-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/67177
PR fortran/67977
* primary.c (match_substring): Add an argument 'deferred' to
flag that a substring reference with null start and end should
not be optimized away for deferred length strings.
(match_string_constant, gfc_match_rvalue): Set the argument.
* trans-expr.c (alloc_scalar_allocatable_for_assignment): If
there is a substring reference return.
* trans-intrinsic.c (conv_intrinsic_move_alloc): For deferred
characters, assign the 'from' string length to the 'to' string
length. If the 'from' expression is deferred, set its string
length to zero. If the 'to' expression has allocatable
components, deallocate them.
2015-10-18 Paul Thomas <pault@gcc.gnu.org>
PR fortran/67177
* gfortran.dg/move_alloc_15.f90: New test
* gfortran.dg/move_alloc_16.f90: New test
PR fortran/67977
* gfortran.dg/deferred_character_assignment_1.f90: New test
Added:
trunk/gcc/testsuite/gfortran.dg/deferred_character_assignment_1.f90
trunk/gcc/testsuite/gfortran.dg/move_alloc_15.f90
trunk/gcc/testsuite/gfortran.dg/move_alloc_16.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/primary.c
trunk/gcc/fortran/trans-expr.c
trunk/gcc/fortran/trans-intrinsic.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/67977] allocatable strings, array section reallocated - non-standard behaviour
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
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu.org @ 2015-10-18 12:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67977
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org
--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
Since I have fixed it on trunk, I might as well assign it to myself!
It will be fixed on 5 branch next weekend.
Cheers
Paul
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/67977] allocatable strings, array section reallocated - non-standard behaviour
2015-10-15 18:55 [Bug fortran/67977] New: allocatable strings, array section reallocated - non-standard behaviour mexas at bristol dot ac.uk
` (2 preceding siblings ...)
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
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: davidgkinniburgh at yahoo dot co.uk @ 2015-10-19 11:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67977
David Kinniburgh <davidgkinniburgh at yahoo dot co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |davidgkinniburgh at yahoo dot co.u
| |k
--- Comment #4 from David Kinniburgh <davidgkinniburgh at yahoo dot co.uk> ---
Does this fix 63469?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/67977] allocatable strings, array section reallocated - non-standard behaviour
2015-10-15 18:55 [Bug fortran/67977] New: allocatable strings, array section reallocated - non-standard behaviour mexas at bristol dot ac.uk
` (3 preceding siblings ...)
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
6 siblings, 0 replies; 8+ messages in thread
From: paul.richard.thomas at gmail dot com @ 2015-10-19 12:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67977
--- Comment #5 from paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> ---
Hi David,
Yes it does. Thank you for bring this PR to my attention. I'll mark it
appropriately.
Cheers
Paul
On 19 October 2015 at 13:42, davidgkinniburgh at yahoo dot co.uk
<gcc-bugzilla@gcc.gnu.org> wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67977
>
> David Kinniburgh <davidgkinniburgh at yahoo dot co.uk> changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |davidgkinniburgh at yahoo dot co.u
> | |k
>
> --- Comment #4 from David Kinniburgh <davidgkinniburgh at yahoo dot co.uk> ---
> Does this fix 63469?
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
> You are the assignee for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/67977] allocatable strings, array section reallocated - non-standard behaviour
2015-10-15 18:55 [Bug fortran/67977] New: allocatable strings, array section reallocated - non-standard behaviour mexas at bristol dot ac.uk
` (4 preceding siblings ...)
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
6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu.org @ 2015-10-26 17:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67977
--- Comment #6 from Paul Thomas <pault at gcc dot gnu.org> ---
Author: pault
Date: Mon Oct 26 17:25:03 2015
New Revision: 229386
URL: https://gcc.gnu.org/viewcvs?rev=229386&root=gcc&view=rev
Log:
2015-10-26 Paul Thomas <pault@gcc.gnu.org>
PR fortran/67177
PR fortran/67977
* primary.c (match_substring): Add an argument 'deferred' to
flag that a substring reference with null start and end should
not be optimized away for deferred length strings.
(match_string_constant, gfc_match_rvalue): Set the argument.
* trans-expr.c (alloc_scalar_allocatable_for_assignment): If
there is a substring reference return.
* trans-intrinsic.c (conv_intrinsic_move_alloc): For deferred
characters, assign the 'from' string length to the 'to' string
length. If the 'from' expression is deferred, set its string
length to zero. If the 'to' expression has allocatable
components, deallocate them.
2015-10-26 Paul Thomas <pault@gcc.gnu.org>
PR fortran/67177
* gfortran.dg/move_alloc_15.f90: New test
* gfortran.dg/move_alloc_16.f90: New test
PR fortran/67977
* gfortran.dg/deferred_character_assignment_1.f90: New test
Added:
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/deferred_character_assignment_1.f90
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/move_alloc_15.f90
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/move_alloc_16.f90
Modified:
branches/gcc-5-branch/gcc/fortran/ChangeLog
branches/gcc-5-branch/gcc/fortran/primary.c
branches/gcc-5-branch/gcc/fortran/trans-expr.c
branches/gcc-5-branch/gcc/fortran/trans-intrinsic.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug fortran/67977] allocatable strings, array section reallocated - non-standard behaviour
2015-10-15 18:55 [Bug fortran/67977] New: allocatable strings, array section reallocated - non-standard behaviour mexas at bristol dot ac.uk
` (5 preceding siblings ...)
2015-10-26 17:25 ` pault at gcc dot gnu.org
@ 2015-10-26 17:27 ` pault at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu.org @ 2015-10-26 17:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67977
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Paul Thomas <pault at gcc dot gnu.org> ---
Fixed on trunk and 5 branch.
Many thanks for the report
Paul
^ 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).