* [Patch, Fortran] PR60881 - fix ICE with allocatable scalar coarrays
@ 2014-04-21 22:13 Tobias Burnus
2014-04-23 9:22 ` Paul Richard Thomas
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Burnus @ 2014-04-21 22:13 UTC (permalink / raw)
To: gcc-patches, gfortran
[-- Attachment #1: Type: text/plain, Size: 325 bytes --]
Dear all,
for a change, a patch for the trunk and not for the fortran-caf branch.
The following is a rather obvious patch which fixes the ICE.
Built and regtested on x86-64-gnu-linux.
OK for the trunk? As it is of rather obvious nature, I will commit it to
the trunk in the next days unless there are objections.
Tobias
[-- Attachment #2: caf_alloc_comp.diff --]
[-- Type: text/x-patch, Size: 1997 bytes --]
2014-04-21 Tobias Burnus <burnus@net-b.de>
PR fortran/60881
* trans-expr.c (gfc_trans_subcomponent_assign): Fix handling
of scalar coarrays.
2014-04-21 Tobias Burnus <burnus@net-b.de>
PR fortran/60881
* coarray/alloc_comp_3.f90: New.
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 955102b..d6f820c 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -5989,7 +5989,8 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr)
{
gfc_init_se (&se, NULL);
/* Pointer component. */
- if (cm->attr.dimension && !cm->attr.proc_pointer)
+ if ((cm->attr.dimension || cm->attr.codimension)
+ && !cm->attr.proc_pointer)
{
/* Array pointer. */
if (expr->expr_type == EXPR_NULL)
@@ -6026,7 +6027,8 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr)
gfc_class_initializer (&cm->ts, expr));
gfc_add_expr_to_block (&block, tmp);
}
- else if (cm->attr.dimension && !cm->attr.proc_pointer)
+ else if ((cm->attr.dimension || cm->attr.codimension)
+ && !cm->attr.proc_pointer)
{
if (cm->attr.allocatable && expr->expr_type == EXPR_NULL)
gfc_conv_descriptor_data_set (&block, dest, null_pointer_node);
diff --git a/gcc/testsuite/gfortran.dg/coarray/alloc_comp_3.f90 b/gcc/testsuite/gfortran.dg/coarray/alloc_comp_3.f90
new file mode 100644
index 0000000..cf2d542
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray/alloc_comp_3.f90
@@ -0,0 +1,23 @@
+! { dg-do compile }
+!
+! PR fortran/60881
+!
+! Contributed by Damian Rouson
+!
+! Was ICEing before
+!
+program main
+ implicit none
+ type co_object
+ logical :: defined=.false.
+ real, allocatable :: dummy_to_facilitate_extension[:]
+ end type
+ type, extends(co_object) :: global_field
+ end type
+ type(global_field) T
+ call assign_local_field(T)
+contains
+ subroutine assign_local_field(lhs)
+ type(global_field) lhs
+ end subroutine
+end program
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Patch, Fortran] PR60881 - fix ICE with allocatable scalar coarrays
2014-04-21 22:13 [Patch, Fortran] PR60881 - fix ICE with allocatable scalar coarrays Tobias Burnus
@ 2014-04-23 9:22 ` Paul Richard Thomas
0 siblings, 0 replies; 2+ messages in thread
From: Paul Richard Thomas @ 2014-04-23 9:22 UTC (permalink / raw)
To: Tobias Burnus; +Cc: gcc-patches, gfortran
Dear Tobias,
As you say, this of a rather obvious nature and is OK for trunk.
Cheers
Paul
On 21 April 2014 22:52, Tobias Burnus <burnus@net-b.de> wrote:
> Dear all,
>
> for a change, a patch for the trunk and not for the fortran-caf branch. The
> following is a rather obvious patch which fixes the ICE.
>
> Built and regtested on x86-64-gnu-linux.
> OK for the trunk? As it is of rather obvious nature, I will commit it to the
> trunk in the next days unless there are objections.
>
> Tobias
--
The knack of flying is learning how to throw yourself at the ground and miss.
--Hitchhikers Guide to the Galaxy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-23 9:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-21 22:13 [Patch, Fortran] PR60881 - fix ICE with allocatable scalar coarrays Tobias Burnus
2014-04-23 9:22 ` 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).