[Bug fortran/68216] [F2003] IO problem with allocatable, deferred character length arrays

2016-01-10 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216

Paul Thomas  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from Paul Thomas  ---
Closed on trunk and 5-branch.

Thanks for the report.

Paul

[Bug fortran/68216] [F2003] IO problem with allocatable, deferred character length arrays

2016-01-10 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216

--- Comment #10 from Paul Thomas  ---
Author: pault
Date: Sun Jan 10 18:06:43 2016
New Revision: 232203

URL: https://gcc.gnu.org/viewcvs?rev=232203&root=gcc&view=rev
Log:
2016-01-10  Paul Thomas  

Backport from mainline.
PR fortran/50221
PR fortran/68216
PR fortran/63932
PR fortran/66408
* trans_array.c (gfc_conv_scalarized_array_ref): Pass the
symbol decl for deferred character length array references.
* trans-stmt.c (gfc_trans_allocate): Keep the string lengths
to update deferred length character string lengths.
* trans-types.c (gfc_get_dtype_rank_type); Use the string
length of deferred character types for the dtype size.
* trans.c (gfc_build_array_ref): For references to deferred
character arrays, use the domain max value, if it is a variable
to set the 'span' and use pointer arithmetic for acces to the
element.
(trans_code): Set gfc_current_locus for diagnostic purposes.

Backport from mainline.
PR fortran/67674
* trans-expr.c (gfc_conv_procedure_call): Do not fix deferred
string lengths of components.

Backport from mainline.
PR fortran/49954
* resolve.c (deferred_op_assign): New function.
(gfc_resolve_code): Call it.
* trans-array.c (concat_str_length): New function.
(gfc_alloc_allocatable_for_assignment): Jump directly to alloc/
realloc blocks for deferred character length arrays because the
string length might change, even if the shape is the same. Call
concat_str_length to obtain the string length for concatenation
since it is needed to compute the lhs string length.
Set the descriptor dtype appropriately for the new string
length.
* trans-expr.c (gfc_trans_assignment_1): Fix the rse string
length for all characters, other than deferred types. For
concatenation operators, push the rse.pre block to the inner
most loop so that the temporary pointer and the assignments
are properly placed.

Backport from mainline.
PR fortran/67779
* trans_array.c (gfc_conv_scalarized_array_ref): Add missing
se->use_offset from condition for calculation of 'base'.

2015-01-10  Paul Thomas  

Backport from mainline.
PR fortran/50221
* gfortran.dg/deferred_character_1.f90: New test.
* gfortran.dg/deferred_character_4.f90: New test for comment
#4 of the PR.

Backport from mainline.
PR fortran/68216
* gfortran.dg/deferred_character_2.f90: New test.

Backport from mainline.
PR fortran/67674
* gfortran.dg/deferred_character_3.f90: New test.

Backport from mainline.
PR fortran/63932
* gfortran.dg/deferred_character_5.f90: New test.

Backport from mainline.
PR fortran/66408
* gfortran.dg/deferred_character_6.f90: New test.

Backport from mainline.
PR fortran/49954
* gfortran.dg/deferred_character_7.f90: New test.

Backport from mainline.
PR fortran/67779
* gfortran.dg/actual_array_offset_1: New test.

Added:
branches/gcc-5-branch/gcc/fortran/ChangeLog-2015
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/deferred_character_1.f90
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/deferred_character_2.f90
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/deferred_character_3.f90
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/deferred_character_4.f90
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/deferred_character_5.f90
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/deferred_character_6.f90
branches/gcc-5-branch/gcc/testsuite/gfortran.dg/deferred_character_7.f90
Modified:
branches/gcc-5-branch/gcc/fortran/ChangeLog
branches/gcc-5-branch/gcc/fortran/resolve.c
branches/gcc-5-branch/gcc/fortran/trans-array.c
branches/gcc-5-branch/gcc/fortran/trans-expr.c
branches/gcc-5-branch/gcc/fortran/trans-stmt.c
branches/gcc-5-branch/gcc/fortran/trans-types.c
branches/gcc-5-branch/gcc/fortran/trans.c
branches/gcc-5-branch/gcc/testsuite/ChangeLog

[Bug fortran/68216] [F2003] IO problem with allocatable, deferred character length arrays

2015-11-15 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216

--- Comment #9 from Paul Thomas  ---
Author: pault
Date: Sun Nov 15 14:07:52 2015
New Revision: 230396

URL: https://gcc.gnu.org/viewcvs?rev=230396&root=gcc&view=rev
Log:
2015-11-15  Paul Thomas  

PR fortran/50221
PR fortran/68216
PR fortran/63932
PR fortran/66408
* trans_array.c (gfc_conv_scalarized_array_ref): Pass the
symbol decl for deferred character length array references.
* trans-stmt.c (gfc_trans_allocate): Keep the string lengths
to update deferred length character string lengths.
* trans-types.c (gfc_get_dtype_rank_type); Use the string
length of deferred character types for the dtype size.
* trans.c (gfc_build_array_ref): For references to deferred
character arrays, use the domain max value, if it is a variable
to set the 'span' and use pointer arithmetic for acces to the
element.
(trans_code): Set gfc_current_locus for diagnostic purposes.

PR fortran/67674
* trans-expr.c (gfc_conv_procedure_call): Do not fix deferred
string lengths of components.

PR fortran/49954
* resolve.c (deferred_op_assign): New function.
(gfc_resolve_code): Call it.
* trans-array.c (concat_str_length): New function.
(gfc_alloc_allocatable_for_assignment): Jump directly to alloc/
realloc blocks for deferred character length arrays because the
string length might change, even if the shape is the same. Call
concat_str_length to obtain the string length for concatenation
since it is needed to compute the lhs string length.
Set the descriptor dtype appropriately for the new string
length.
* trans-expr.c (gfc_trans_assignment_1): Use the rse string
length for all characters, other than deferred types. For
concatenation operators, push the rse.pre block to the inner
most loop so that the temporary pointer and the assignments
are properly placed.

2015-11-15  Paul Thomas  

PR fortran/50221
* gfortran.dg/deferred_character_1.f90: New test.
* gfortran.dg/deferred_character_4.f90: New test for comment
#4 of the PR.

PR fortran/68216
* gfortran.dg/deferred_character_2.f90: New test.

PR fortran/67674
* gfortran.dg/deferred_character_3.f90: New test.

PR fortran/63932
* gfortran.dg/deferred_character_5.f90: New test.

PR fortran/66408
* gfortran.dg/deferred_character_6.f90: New test.

PR fortran/49954
* gfortran.dg/deferred_character_7.f90: New test.

Added:
trunk/gcc/testsuite/gfortran.dg/deferred_character_1.f90
trunk/gcc/testsuite/gfortran.dg/deferred_character_2.f90
trunk/gcc/testsuite/gfortran.dg/deferred_character_3.f90
trunk/gcc/testsuite/gfortran.dg/deferred_character_4.f90
trunk/gcc/testsuite/gfortran.dg/deferred_character_5.f90
trunk/gcc/testsuite/gfortran.dg/deferred_character_6.f90
trunk/gcc/testsuite/gfortran.dg/deferred_character_7.f90
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/fortran/trans-array.c
trunk/gcc/fortran/trans-expr.c
trunk/gcc/fortran/trans-stmt.c
trunk/gcc/fortran/trans.c
trunk/gcc/testsuite/ChangeLog

[Bug fortran/68216] [F2003] IO problem with allocatable, deferred character length arrays

2015-11-07 Thread pault at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216

--- Comment #8 from Paul Thomas  ---
I had a devil of a job fixing the second testcase, from "Blockbuster", in the
clf thread above:

program testdefchar
implicit none
character(:), allocatable :: test(:)

allocate(character(3) :: test(2))
test(1) = 'abc'
test(2) = 'def'
write(*,*) test(1), test(2)

test = ['aa','bb','cc']
write(*,*) test(1), test(2), test(3)

end program testdefchar

The fix is now regtesting.

Paul

[Bug fortran/68216] [F2003] IO problem with allocatable, deferred character length arrays

2015-11-06 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216

--- Comment #7 from Dominique d'Humieres  ---
> I think that a meta-bug would be an excellent idea.

It is pr68241.

[Bug fortran/68216] [F2003] IO problem with allocatable, deferred character length arrays

2015-11-06 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216

--- Comment #6 from Dominique d'Humieres  ---
> Paul, I'm delighted than someone is finally working on this long-standing
> problem.

Seconded!

> I hope you're also taking a look at all the other related PRs that Dominique
> pointed out; I suspect that they all share the same core error.  -Neil

Well, don't hope too much! If I had found obvious duplicates, I'ld say so
(besides pr55735 appearing twice after correction and this PR being probably a
duplicate of pr50221).

[Bug fortran/68216] [F2003] IO problem with allocatable, deferred character length arrays

2015-11-06 Thread neil.n.carlson at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216

--- Comment #5 from neil.n.carlson at gmail dot com ---
Paul, I'm delighted than someone is finally working on this long-standing
problem. I hope you're also taking a look at all the other related PRs that
Dominique pointed out; I suspect that they all share the same core error. 
-Neil

[Bug fortran/68216] [F2003] IO problem with allocatable, deferred character length arrays

2015-11-06 Thread paul.richard.thomas at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216

--- Comment #4 from paul.richard.thomas at gmail dot com  ---
Dear Dominique,

I think that a meta-bug would be an excellent idea.  I am 5
regressions away from a fix for this PR. I'll get the patch to you
over the weekend.

Many thanks for your support

Paul

On 5 November 2015 at 10:33, dominiq at lps dot ens.fr
 wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216
>
> --- Comment #2 from Dominique d'Humieres  ---
> If this help, I have found the following PRs related to deferred-length:
> pr49630, pr49954, pr50221, pr54070, pr55735, pr57735, pr57910, pr63932,
> pr65677, pr66408, and pr67674. Will it worth opening a "meta-bug" for them? or
> adding '[DL]' at the beginning of the summaries?
>
> --
> You are receiving this mail because:
> You reported the bug.

[Bug fortran/68216] [F2003] IO problem with allocatable, deferred character length arrays

2015-11-05 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216

--- Comment #3 from Dominique d'Humieres  ---
Oops! read pr55735 instead of pr57735.

[Bug fortran/68216] [F2003] IO problem with allocatable, deferred character length arrays

2015-11-05 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216

--- Comment #2 from Dominique d'Humieres  ---
If this help, I have found the following PRs related to deferred-length:
pr49630, pr49954, pr50221, pr54070, pr55735, pr57735, pr57910, pr63932,
pr65677, pr66408, and pr67674. Will it worth opening a "meta-bug" for them? or
adding '[DL]' at the beginning of the summaries?

[Bug fortran/68216] [F2003] IO problem with allocatable, deferred character length arrays

2015-11-04 Thread dominiq at lps dot ens.fr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68216

Dominique d'Humieres  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2015-11-05
 Ever confirmed|0   |1

--- Comment #1 from Dominique d'Humieres  ---
I am not sure it has anything to do with IO, but I think it is rather a
duplicate of pr50221.