* [Patch, fortran] PR93671 - gfortran 8-10 ICE on intrinsic assignment to allocatable derived-type component of coarray
@ 2020-08-10 15:03 Andre Vehreschild
2020-08-12 16:58 ` Thomas Koenig
2020-08-13 2:04 ` Jerry DeLisle
0 siblings, 2 replies; 5+ messages in thread
From: Andre Vehreschild @ 2020-08-10 15:03 UTC (permalink / raw)
To: GCC-Fortran-ML, GCC-Patches-ML
[-- Attachment #1: Type: text/plain, Size: 534 bytes --]
Hi folks,
long time, no see. I was asked by Damian to do some Coarray stuff in gfortran
so here is the first step on fixing a bug. The issue at hand is, that the
coarray handling is not propagated correctly and later on the coarray-token
not generated/retrieved from the correct position leading to coarray programs to
crash/hang. This patch fixes at least the misbehavior reported in the PR. More
to come.
Regtests ok on FC31.x86_64. Ok for trunk?
Regards,
Andre
--
Andre Vehreschild * Email: vehre ad gmx dot de
[-- Attachment #2: pr93671.clog --]
[-- Type: text/plain, Size: 385 bytes --]
gcc/fortran/ChangeLog:
2020-08-10 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/93671
* trans-array.c (structure_alloc_comps): Keep caf-mode when applying to
components; get the caf_token correctly for allocated scalar components.
gcc/testsuite/ChangeLog:
2020-08-10 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/93671
* gfortran.dg/coarray/pr93671.f90: New test.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: pr93671.patch --]
[-- Type: text/x-patch, Size: 2625 bytes --]
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 8f93b43bafb..7a1b2fc74c9 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -8627,14 +8627,13 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
vref = gfc_build_array_ref (var, index, NULL);
- if ((purpose == COPY_ALLOC_COMP || purpose == COPY_ONLY_ALLOC_COMP)
- && !caf_enabled (caf_mode))
+ if (purpose == COPY_ALLOC_COMP || purpose == COPY_ONLY_ALLOC_COMP)
{
tmp = build_fold_indirect_ref_loc (input_location,
gfc_conv_array_data (dest));
dref = gfc_build_array_ref (tmp, index, NULL);
tmp = structure_alloc_comps (der_type, vref, dref, rank,
- COPY_ALLOC_COMP, 0, args);
+ COPY_ALLOC_COMP, caf_mode, args);
}
else
tmp = structure_alloc_comps (der_type, vref, NULL_TREE, rank, purpose,
@@ -9375,12 +9374,21 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
else if (flag_coarray == GFC_FCOARRAY_LIB
&& caf_in_coarray (caf_mode))
{
- tree dst_tok = c->as ? gfc_conv_descriptor_token (dcmp)
- : fold_build3_loc (input_location,
- COMPONENT_REF,
- pvoid_type_node, dest,
- c->caf_token,
- NULL_TREE);
+ tree dst_tok;
+ if (c->as)
+ dst_tok = gfc_conv_descriptor_token (dcmp);
+ else
+ {
+ /* For a scalar allocatable component the caf_token is
+ the next component. */
+ if (!c->caf_token)
+ c->caf_token = c->next->backend_decl;
+ dst_tok = fold_build3_loc (input_location,
+ COMPONENT_REF,
+ pvoid_type_node, dest,
+ c->caf_token,
+ NULL_TREE);
+ }
tmp = duplicate_allocatable_coarray (dcmp, dst_tok, comp,
ctype, rank);
}
diff --git a/gcc/testsuite/gfortran.dg/coarray/pr93671.f90 b/gcc/testsuite/gfortran.dg/coarray/pr93671.f90
new file mode 100644
index 00000000000..8d26ff88753
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray/pr93671.f90
@@ -0,0 +1,24 @@
+! { dg-do run }
+
+! PR/fortran 93671 - ICE on intrinsic assignment to allocatable derived-type
+! component of coarray
+
+ type flux_planes
+ integer, allocatable :: normals
+ end type
+
+ type package
+ type(flux_planes) surface_fluxes(1)
+ end type
+
+ type(package) mail[*], halo_data
+
+ halo_data%surface_fluxes(1)%normals = 1
+ mail = halo_data
+
+ if (any(size(mail%surface_fluxes) /= [1]) .OR. &
+ mail%surface_fluxes(1)%normals /= 1) then
+ stop 1
+ end if
+end
+
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch, fortran] PR93671 - gfortran 8-10 ICE on intrinsic assignment to allocatable derived-type component of coarray
2020-08-10 15:03 [Patch, fortran] PR93671 - gfortran 8-10 ICE on intrinsic assignment to allocatable derived-type component of coarray Andre Vehreschild
@ 2020-08-12 16:58 ` Thomas Koenig
2020-08-13 14:09 ` Andre Vehreschild
2020-08-13 2:04 ` Jerry DeLisle
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Koenig @ 2020-08-12 16:58 UTC (permalink / raw)
To: Andre Vehreschild, GCC-Fortran-ML, GCC-Patches-ML
Hi Andre,
> Regtests ok on FC31.x86_64. Ok for trunk?
Good thing you're back! Any help with bugfixing is
highly appreciated, and Coarrays certainly can use
some work.
The patch is OK for trunk.
Best regards
Thomas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch, fortran] PR93671 - gfortran 8-10 ICE on intrinsic assignment to allocatable derived-type component of coarray
2020-08-10 15:03 [Patch, fortran] PR93671 - gfortran 8-10 ICE on intrinsic assignment to allocatable derived-type component of coarray Andre Vehreschild
2020-08-12 16:58 ` Thomas Koenig
@ 2020-08-13 2:04 ` Jerry DeLisle
2020-08-13 14:10 ` Andre Vehreschild
1 sibling, 1 reply; 5+ messages in thread
From: Jerry DeLisle @ 2020-08-13 2:04 UTC (permalink / raw)
To: Andre Vehreschild, GCC-Fortran-ML, GCC-Patches-ML
This look good, OK to commit.
Thanks,
Jerry
On 8/10/20 8:03 AM, Andre Vehreschild wrote:
> Hi folks,
>
> long time, no see. I was asked by Damian to do some Coarray stuff in gfortran
> so here is the first step on fixing a bug. The issue at hand is, that the
> coarray handling is not propagated correctly and later on the coarray-token
> not generated/retrieved from the correct position leading to coarray programs to
> crash/hang. This patch fixes at least the misbehavior reported in the PR. More
> to come.
>
> Regtests ok on FC31.x86_64. Ok for trunk?
>
> Regards,
> Andre
> --
> Andre Vehreschild * Email: vehre ad gmx dot de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch, fortran] PR93671 - gfortran 8-10 ICE on intrinsic assignment to allocatable derived-type component of coarray
2020-08-12 16:58 ` Thomas Koenig
@ 2020-08-13 14:09 ` Andre Vehreschild
0 siblings, 0 replies; 5+ messages in thread
From: Andre Vehreschild @ 2020-08-13 14:09 UTC (permalink / raw)
To: Thomas Koenig; +Cc: GCC-Fortran-ML, GCC-Patches-ML
Hi Thomas,
thanks for the review. Committed to trunk.
That's what I am here for: to fix some issues with coarrays.
Regards,
Andre
On Wed, 12 Aug 2020 18:58:01 +0200
Thomas Koenig <tkoenig@netcologne.de> wrote:
> Hi Andre,
>
> > Regtests ok on FC31.x86_64. Ok for trunk?
>
> Good thing you're back! Any help with bugfixing is
> highly appreciated, and Coarrays certainly can use
> some work.
>
> The patch is OK for trunk.
>
> Best regards
>
> Thomas
--
Andre Vehreschild * Email: vehre ad gmx dot de
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Patch, fortran] PR93671 - gfortran 8-10 ICE on intrinsic assignment to allocatable derived-type component of coarray
2020-08-13 2:04 ` Jerry DeLisle
@ 2020-08-13 14:10 ` Andre Vehreschild
0 siblings, 0 replies; 5+ messages in thread
From: Andre Vehreschild @ 2020-08-13 14:10 UTC (permalink / raw)
To: Jerry DeLisle; +Cc: GCC-Fortran-ML
Hi Jerry,
thanks for the review. Commited to trunk.
Regards,
Andre
On Wed, 12 Aug 2020 19:04:26 -0700
Jerry DeLisle <jvdelisle2@gmail.com> wrote:
> This look good, OK to commit.
>
> Thanks,
>
> Jerry
>
> On 8/10/20 8:03 AM, Andre Vehreschild wrote:
> > Hi folks,
> >
> > long time, no see. I was asked by Damian to do some Coarray stuff in
> > gfortran so here is the first step on fixing a bug. The issue at hand is,
> > that the coarray handling is not propagated correctly and later on the
> > coarray-token not generated/retrieved from the correct position leading to
> > coarray programs to crash/hang. This patch fixes at least the misbehavior
> > reported in the PR. More to come.
> >
> > Regtests ok on FC31.x86_64. Ok for trunk?
> >
> > Regards,
> > Andre
> > --
> > Andre Vehreschild * Email: vehre ad gmx dot de
>
--
Andre Vehreschild * Email: vehre ad gmx dot de
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-13 14:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 15:03 [Patch, fortran] PR93671 - gfortran 8-10 ICE on intrinsic assignment to allocatable derived-type component of coarray Andre Vehreschild
2020-08-12 16:58 ` Thomas Koenig
2020-08-13 14:09 ` Andre Vehreschild
2020-08-13 2:04 ` Jerry DeLisle
2020-08-13 14:10 ` Andre Vehreschild
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).