Discussion:
[Patch, fortran] PR87151 - allocating array of character
Paul Richard Thomas
2018-10-07 18:00:49 UTC
Permalink
This turned out to be rather more than the allocation... The ChangeLog
and the patch tell the story well enough.

Bootstraps and regtests on FC28/x86_64 - OK for trunk and later for 8-branch?

Cheers

Paul

2018-10-07 Paul Thomas <***@gcc.gnu.org>

PR fortran/87151
* trans-array.c (gfc_get_array_span): Deal with deferred char
array components having a TYPE_MAX_VALUE of zero.
(gfc_array_init_size): Use the hidden string length component
to build the descriptor dtype.
(gfc_array_allocate): Remove the erroneous replacement of the
charlen backend decl with a temporary.
(gfc_conv_expr_descriptor): Use the ss_info string length in
the case of deferred character components.
(gfc_alloc_allocatable_for_assignment): Actually compare the
string lengths for deferred characters. Make sure that kind > 1
is handled correctly. Set the span field of the descriptor.
* trans-intrinsic.c (gfc_conv_intrinsic_len): Remove the stupid
comment.

2018-10-07 Paul Thomas <***@gcc.gnu.org>

PR fortran/87151
* gfortran.dg/deferred_type_component_3.f90: New test.
Dominique d'Humières
2018-10-08 09:08:15 UTC
Permalink
Hi Paul,

Your patch works as expected. It also fixes the ICEs for the tests in pr80931
(and the test accidentally attached to pr83196).

Thanks for the patch.

Dominique
Paul Richard Thomas
2018-10-08 13:23:39 UTC
Permalink
Hi Dominique,

Thanks for the testing. Although the tests for PR80931 and PR83196,
comment #4, compiled OK, when I attempted to use the modules both
segfaulted for the same reason ('span' not being set on the array
descriptor) and these required a slightly different version of the
same tweak.

The attached regtests fine on FC28/x86_64 - OK for trunk and later for 8-branch?

Cheers

Paul

2018-10-07 Paul Thomas <***@gcc.gnu.org>

PR fortran/87151
* trans-array.c (gfc_get_array_span): Deal with deferred char
array components having a TYPE_MAX_VALUE of zero.
(gfc_array_init_size): Use the hidden string length component
to build the descriptor dtype.
(gfc_array_allocate): Remove the erroneous replacement of the
charlen backend decl with a temporary.
(gfc_conv_expr_descriptor): Use the ss_info string length in
the case of deferred character components.
(gfc_alloc_allocatable_for_assignment): Actually compare the
string lengths for deferred characters. Make sure that kind > 1
is handled correctly. Set the span field of the descriptor.
* trans-intrinsic.c (gfc_conv_intrinsic_len): Remove the stupid
comment.

PR fortran/80931
* trans-array.c (gfc_array_allocate): Set the span field for
variable length character arrays.


2018-10-07 Paul Thomas <***@gcc.gnu.org>

PR fortran/87151
* gfortran.dg/deferred_type_component_3.f90: New test.

PR fortran/80931
* gfortran.dg/deferred_character_28.f90: New test.
* gfortran.dg/deferred_character_29.f90: New test (note that
this test appears in PR83196 comment #4 by mistake).
Post by Dominique d'Humières
Hi Paul,
Your patch works as expected. It also fixes the ICEs for the tests in pr80931
(and the test accidentally attached to pr83196).
Thanks for the patch.
Dominique
--
"If you can't explain it simply, you don't understand it well enough"
- Albert Einstein
Thomas Koenig
2018-10-08 22:15:58 UTC
Permalink
Hi Paul,
Post by Paul Richard Thomas
Bootstraps and regtests on FC28/x86_64 - OK for trunk and later for 8-branch?
OK.

Thanks for the patch!

Regards

Thomas

Loading...