* [Patch, fortran] PR93833 - [8/9/10 Regression] ICE in trans_array_constructor, at fortran/trans-array.c:2566
@ 2020-03-08 12:35 Paul Richard Thomas
2020-04-01 17:07 ` Fritz Reese
0 siblings, 1 reply; 5+ messages in thread
From: Paul Richard Thomas @ 2020-03-08 12:35 UTC (permalink / raw)
To: fortran, gcc-patches
This is yet another case, where a deferred character length variable
loses the character length backend_decl. As previously, converting the
expression and using the string_length recovers it successfully.
Regtested on FC31/x86_64 - OK for trunk, followed by 8- and 9-branches
after a week or two?
Paul
2020-03-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/93833
* trans-array.c (get_array_ctor_var_strlen): If the character
length backend_decl cannot be found, convert the expression and
use the string length. Clear up some minor white space issues in
the rest of the file.
2020-03-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/93833
* gfortran.dg/deferred_character_36.f90 : New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch, fortran] PR93833 - [8/9/10 Regression] ICE in trans_array_constructor, at fortran/trans-array.c:2566
2020-03-08 12:35 [Patch, fortran] PR93833 - [8/9/10 Regression] ICE in trans_array_constructor, at fortran/trans-array.c:2566 Paul Richard Thomas
@ 2020-04-01 17:07 ` Fritz Reese
2020-12-28 11:27 ` Paul Richard Thomas
0 siblings, 1 reply; 5+ messages in thread
From: Fritz Reese @ 2020-04-01 17:07 UTC (permalink / raw)
To: Paul Richard Thomas; +Cc: fortran, gcc-patches
Unfortunately the mailing list stripped off this attachment so we do
not have a chance to review. As attachments appear to be working
lately, please resubmit this patch.
Fritz
On Sun, Mar 8, 2020 at 8:58 AM Paul Richard Thomas
<paul.richard.thomas@gmail.com> wrote:
>
> This is yet another case, where a deferred character length variable
> loses the character length backend_decl. As previously, converting the
> expression and using the string_length recovers it successfully.
>
> Regtested on FC31/x86_64 - OK for trunk, followed by 8- and 9-branches
> after a week or two?
>
> Paul
>
> 2020-03-08 Paul Thomas <pault@gcc.gnu.org>
>
> PR fortran/93833
> * trans-array.c (get_array_ctor_var_strlen): If the character
> length backend_decl cannot be found, convert the expression and
> use the string length. Clear up some minor white space issues in
> the rest of the file.
>
> 2020-03-08 Paul Thomas <pault@gcc.gnu.org>
>
> PR fortran/93833
> * gfortran.dg/deferred_character_36.f90 : New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch, fortran] PR93833 - [8/9/10 Regression] ICE in trans_array_constructor, at fortran/trans-array.c:2566
2020-04-01 17:07 ` Fritz Reese
@ 2020-12-28 11:27 ` Paul Richard Thomas
2020-12-28 17:10 ` Thomas Koenig
0 siblings, 1 reply; 5+ messages in thread
From: Paul Richard Thomas @ 2020-12-28 11:27 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 853 bytes --]
Hi All,
I am in the midst of an end-of-year tidy up and found this:
On Wed, 1 Apr 2020 at 18:07, Fritz Reese <fritzoreese@gmail.com> wrote:
> Unfortunately the mailing list stripped off this attachment so we do
> not have a chance to review. As attachments appear to be working
> lately, please resubmit this patch.
>
>
Retested on FC33/x86_64 - OK for master, then 9&10 branches in a few weeks?
Paul
Fortran: Fix deferred character lengths in array constructors [PR93833].
2020-12-28 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/93833
* trans-array.c (get_array_ctor_var_strlen): If the character
length backend_decl cannot be found, convert the expression and
use the string length. Clear up some minor white space issues
in the rest of the file.
gcc/testsuite/
PR fortran/93833
* gfortran.dg/deferred_character_36.f90 : New test.
[-- Attachment #2: deferred_character_36.f90 --]
[-- Type: text/x-fortran, Size: 303 bytes --]
! { dg-do run }
!
! Test the fix for PR93833, which ICEd as shown.
!
! Contributed by Gerhard Steinmetz <gscfq@t-online.de>
!
program p
character(:), allocatable :: c
c = "wxyz"
contains
subroutine s
associate (y => [c])
if (any(y /= [c])) stop 1
end associate
end
end
[-- Attachment #3: submit.diff --]
[-- Type: text/x-patch, Size: 1010 bytes --]
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 2c6be710ac8..33e05be5bd1 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -2199,6 +2199,7 @@ get_array_ctor_var_strlen (stmtblock_t *block, gfc_expr * expr, tree * len)
gfc_ref *ref;
gfc_typespec *ts;
mpz_t char_len;
+ gfc_se se;
/* Don't bother if we already know the length is a constant. */
if (*len && INTEGER_CST_P (*len))
@@ -2244,6 +2245,19 @@ get_array_ctor_var_strlen (stmtblock_t *block, gfc_expr * expr, tree * len)
}
}
+ /* A last ditch attempt that is sometimes needed for deferred characters. */
+ if (!ts->u.cl->backend_decl)
+ {
+ gfc_init_se (&se, NULL);
+ if (expr->rank)
+ gfc_conv_expr_descriptor (&se, expr);
+ else
+ gfc_conv_expr (&se, expr);
+ gcc_assert (se.string_length != NULL_TREE);
+ gfc_add_block_to_block (block, &se.pre);
+ ts->u.cl->backend_decl = se.string_length;
+ }
+
*len = ts->u.cl->backend_decl;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch, fortran] PR93833 - [8/9/10 Regression] ICE in trans_array_constructor, at fortran/trans-array.c:2566
2020-12-28 11:27 ` Paul Richard Thomas
@ 2020-12-28 17:10 ` Thomas Koenig
2020-12-29 17:40 ` Paul Richard Thomas
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Koenig @ 2020-12-28 17:10 UTC (permalink / raw)
To: Paul Richard Thomas, fortran, gcc-patches
Hi Paul,
>>
> Retested on FC33/x86_64 - OK for master, then 9&10 branches in a few weeks?
OK.
Thanks a lot for the patch!
Best regards
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch, fortran] PR93833 - [8/9/10 Regression] ICE in trans_array_constructor, at fortran/trans-array.c:2566
2020-12-28 17:10 ` Thomas Koenig
@ 2020-12-29 17:40 ` Paul Richard Thomas
0 siblings, 0 replies; 5+ messages in thread
From: Paul Richard Thomas @ 2020-12-29 17:40 UTC (permalink / raw)
To: Thomas Koenig; +Cc: fortran, gcc-patches
Hi Thomas,
Thanks for taking a look at the patch. Applied to master as
r11-6364-gfeae0af82753e06fbff6103da5fbb3b28e1ddbd7 .
The branches will follow in a week or so.
Regards
Paul
On Mon, 28 Dec 2020 at 17:10, Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hi Paul,
>
> >>
> > Retested on FC33/x86_64 - OK for master, then 9&10 branches in a few
> weeks?
>
> OK.
>
> Thanks a lot for the patch!
>
> Best regards
>
> Thomas
>
--
"If you can't explain it simply, you don't understand it well enough" -
Albert Einstein
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-29 17:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-08 12:35 [Patch, fortran] PR93833 - [8/9/10 Regression] ICE in trans_array_constructor, at fortran/trans-array.c:2566 Paul Richard Thomas
2020-04-01 17:07 ` Fritz Reese
2020-12-28 11:27 ` Paul Richard Thomas
2020-12-28 17:10 ` Thomas Koenig
2020-12-29 17:40 ` Paul Richard Thomas
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).