* [Fortran, Patch, PR71807, v1] [5/6/7 Regression] Internal compiler error with NULL() reference in structure constructor
@ 2016-07-14 16:17 Andre Vehreschild
2016-07-14 17:49 ` Jerry DeLisle
0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2016-07-14 16:17 UTC (permalink / raw)
To: GCC-Patches-ML, GCC-Fortran-ML
[-- Attachment #1: Type: text/plain, Size: 326 bytes --]
Hi all,
attached patch fixes the ICE when assigning null() to an allocatable
component in an initializer.
Bootstrapped and regtested on x86_64-linux/F23 ok for trunk,
gcc-6-branch and gcc-5-branch.
Ok for trunk and one week later for the other branches?
Regards,
Andre
--
Andre Vehreschild * Email: vehre ad gmx dot de
[-- Attachment #2: pr71807_v1.clog --]
[-- Type: text/plain, Size: 355 bytes --]
gcc/fortran/ChangeLog:
2016-07-14 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/71807
* trans-expr.c (gfc_trans_subcomponent_assign): Special casing
when allocatable component is set to null() in initializer.
gcc/testsuite/ChangeLog:
2016-07-14 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/71807
* gfortran.dg/null_9.f90: New test.
[-- Attachment #3: pr71807_v1.patch --]
[-- Type: text/x-patch, Size: 1453 bytes --]
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 4321850..e3559f4 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -7200,6 +7200,12 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr,
tmp = gfc_trans_alloc_subarray_assign (tmp, cm, expr);
gfc_add_expr_to_block (&block, tmp);
}
+ else if (init && cm->attr.allocatable && expr->expr_type == EXPR_NULL)
+ {
+ /* NULL initialization for allocatable components. */
+ gfc_add_modify (&block, dest, fold_convert (TREE_TYPE (dest),
+ null_pointer_node));
+ }
else if (init && (cm->attr.allocatable
|| (cm->ts.type == BT_CLASS && CLASS_DATA (cm)->attr.allocatable
&& expr->ts.type != BT_CLASS)))
diff --git a/gcc/testsuite/gfortran.dg/null_9.f90 b/gcc/testsuite/gfortran.dg/null_9.f90
new file mode 100644
index 0000000..9afd938
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/null_9.f90
@@ -0,0 +1,30 @@
+! { dg-do run }
+
+MODULE fold_convert_loc_ice
+ IMPLICIT NONE
+ PRIVATE
+
+ TYPE, PUBLIC :: ta
+ PRIVATE
+ INTEGER :: a_comp
+ END TYPE ta
+
+ TYPE, PUBLIC :: tb
+ TYPE(ta), ALLOCATABLE :: b_comp
+ END TYPE tb
+
+ PUBLIC :: proc
+CONTAINS
+ SUBROUTINE proc
+ TYPE(tb) :: b
+
+ b = tb(null())
+ if (allocated( b%b_comp )) call abort()
+ END SUBROUTINE proc
+END MODULE fold_convert_loc_ice
+
+ USE fold_convert_loc_ice
+
+ call proc()
+END
+
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Fortran, Patch, PR71807, v1] [5/6/7 Regression] Internal compiler error with NULL() reference in structure constructor
2016-07-14 16:17 [Fortran, Patch, PR71807, v1] [5/6/7 Regression] Internal compiler error with NULL() reference in structure constructor Andre Vehreschild
@ 2016-07-14 17:49 ` Jerry DeLisle
2016-07-15 9:29 ` Andre Vehreschild
0 siblings, 1 reply; 4+ messages in thread
From: Jerry DeLisle @ 2016-07-14 17:49 UTC (permalink / raw)
To: Andre Vehreschild, GCC-Patches-ML, GCC-Fortran-ML
On 07/14/2016 09:17 AM, Andre Vehreschild wrote:
> Hi all,
>
> attached patch fixes the ICE when assigning null() to an allocatable
> component in an initializer.
>
> Bootstrapped and regtested on x86_64-linux/F23 ok for trunk,
> gcc-6-branch and gcc-5-branch.
>
> Ok for trunk and one week later for the other branches?
>
> Regards,
> Andre
>
Yes, OK and thanks for patch.
Jerry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Fortran, Patch, PR71807, v1] [5/6/7 Regression] Internal compiler error with NULL() reference in structure constructor
2016-07-14 17:49 ` Jerry DeLisle
@ 2016-07-15 9:29 ` Andre Vehreschild
2016-07-22 15:21 ` Andre Vehreschild
0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2016-07-15 9:29 UTC (permalink / raw)
To: Jerry DeLisle; +Cc: GCC-Patches-ML, GCC-Fortran-ML
[-- Attachment #1: Type: text/plain, Size: 649 bytes --]
Hi Jerry,
thanks for the fast review. Committed to trunk as r238368.
Regards,
Andre
On Thu, 14 Jul 2016 10:49:37 -0700
Jerry DeLisle <jvdelisle@charter.net> wrote:
> On 07/14/2016 09:17 AM, Andre Vehreschild wrote:
> > Hi all,
> >
> > attached patch fixes the ICE when assigning null() to an allocatable
> > component in an initializer.
> >
> > Bootstrapped and regtested on x86_64-linux/F23 ok for trunk,
> > gcc-6-branch and gcc-5-branch.
> >
> > Ok for trunk and one week later for the other branches?
> >
> > Regards,
> > Andre
> >
>
> Yes, OK and thanks for patch.
>
> Jerry
--
Andre Vehreschild * Email: vehre ad gmx dot de
[-- Attachment #2: submit.diff --]
[-- Type: text/x-patch, Size: 2319 bytes --]
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (Revision 238367)
+++ gcc/fortran/ChangeLog (Arbeitskopie)
@@ -1,3 +1,9 @@
+2016-07-15 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/71807
+ * trans-expr.c (gfc_trans_subcomponent_assign): Special casing
+ when allocatable component is set to null() in initializer.
+
2016-07-14 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/29819
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (Revision 238367)
+++ gcc/fortran/trans-expr.c (Arbeitskopie)
@@ -7200,6 +7200,12 @@
tmp = gfc_trans_alloc_subarray_assign (tmp, cm, expr);
gfc_add_expr_to_block (&block, tmp);
}
+ else if (init && cm->attr.allocatable && expr->expr_type == EXPR_NULL)
+ {
+ /* NULL initialization for allocatable components. */
+ gfc_add_modify (&block, dest, fold_convert (TREE_TYPE (dest),
+ null_pointer_node));
+ }
else if (init && (cm->attr.allocatable
|| (cm->ts.type == BT_CLASS && CLASS_DATA (cm)->attr.allocatable
&& expr->ts.type != BT_CLASS)))
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (Revision 238367)
+++ gcc/testsuite/ChangeLog (Arbeitskopie)
@@ -1,3 +1,8 @@
+2016-07-15 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/71807
+ * gfortran.dg/null_9.f90: New test.
+
2016-07-15 Bin Cheng <bin.cheng@arm.com>
* gcc.dg/tree-ssa/loop-41.c: New test.
Index: gcc/testsuite/gfortran.dg/null_9.f90
===================================================================
--- gcc/testsuite/gfortran.dg/null_9.f90 (nicht existent)
+++ gcc/testsuite/gfortran.dg/null_9.f90 (Arbeitskopie)
@@ -0,0 +1,30 @@
+! { dg-do run }
+
+MODULE fold_convert_loc_ice
+ IMPLICIT NONE
+ PRIVATE
+
+ TYPE, PUBLIC :: ta
+ PRIVATE
+ INTEGER :: a_comp
+ END TYPE ta
+
+ TYPE, PUBLIC :: tb
+ TYPE(ta), ALLOCATABLE :: b_comp
+ END TYPE tb
+
+ PUBLIC :: proc
+CONTAINS
+ SUBROUTINE proc
+ TYPE(tb) :: b
+
+ b = tb(null())
+ if (allocated( b%b_comp )) call abort()
+ END SUBROUTINE proc
+END MODULE fold_convert_loc_ice
+
+ USE fold_convert_loc_ice
+
+ call proc()
+END
+
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Fortran, Patch, PR71807, v1] [5/6/7 Regression] Internal compiler error with NULL() reference in structure constructor
2016-07-15 9:29 ` Andre Vehreschild
@ 2016-07-22 15:21 ` Andre Vehreschild
0 siblings, 0 replies; 4+ messages in thread
From: Andre Vehreschild @ 2016-07-22 15:21 UTC (permalink / raw)
To: Jerry DeLisle; +Cc: GCC-Patches-ML, GCC-Fortran-ML
[-- Attachment #1: Type: text/plain, Size: 890 bytes --]
Hi all,
committed to gcc-6-branch as r238649, and
to gcc-5-branch as r238650.
Regards,
Andre
On Fri, 15 Jul 2016 11:29:37 +0200
Andre Vehreschild <vehre@gmx.de> wrote:
> Hi Jerry,
>
> thanks for the fast review. Committed to trunk as r238368.
>
> Regards,
> Andre
>
> On Thu, 14 Jul 2016 10:49:37 -0700
> Jerry DeLisle <jvdelisle@charter.net> wrote:
>
> > On 07/14/2016 09:17 AM, Andre Vehreschild wrote:
> > > Hi all,
> > >
> > > attached patch fixes the ICE when assigning null() to an
> > > allocatable component in an initializer.
> > >
> > > Bootstrapped and regtested on x86_64-linux/F23 ok for trunk,
> > > gcc-6-branch and gcc-5-branch.
> > >
> > > Ok for trunk and one week later for the other branches?
> > >
> > > Regards,
> > > Andre
> > >
> >
> > Yes, OK and thanks for patch.
> >
> > Jerry
>
>
--
Andre Vehreschild * Email: vehre ad gmx dot de
[-- Attachment #2: submit_gcc-6.diff --]
[-- Type: text/x-patch, Size: 2517 bytes --]
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (Revision 238640)
+++ gcc/fortran/ChangeLog (Arbeitskopie)
@@ -1,5 +1,12 @@
2016-07-22 Andre Vehreschild <vehre@gcc.gnu.org>
+ Backported from trunk:
+ PR fortran/71807
+ * trans-expr.c (gfc_trans_subcomponent_assign): Special casing
+ when allocatable component is set to null() in initializer.
+
+2016-07-22 Andre Vehreschild <vehre@gcc.gnu.org>
+
Backport from trunk:
PR fortran/70842
* simplify.c (gfc_simplify_len): Only for unlimited polymorphic
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (Revision 238639)
+++ gcc/fortran/trans-expr.c (Arbeitskopie)
@@ -7200,6 +7200,12 @@
tmp = gfc_trans_alloc_subarray_assign (tmp, cm, expr);
gfc_add_expr_to_block (&block, tmp);
}
+ else if (init && cm->attr.allocatable && expr->expr_type == EXPR_NULL)
+ {
+ /* NULL initialization for allocatable components. */
+ gfc_add_modify (&block, dest, fold_convert (TREE_TYPE (dest),
+ null_pointer_node));
+ }
else if (init && (cm->attr.allocatable
|| (cm->ts.type == BT_CLASS && CLASS_DATA (cm)->attr.allocatable
&& expr->ts.type != BT_CLASS)))
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (Revision 238640)
+++ gcc/testsuite/ChangeLog (Arbeitskopie)
@@ -1,5 +1,11 @@
2016-07-22 Andre Vehreschild <vehre@gcc.gnu.org>
+ Backported from trunk:
+ PR fortran/71807
+ * gfortran.dg/null_9.f90: New test.
+
+2016-07-22 Andre Vehreschild <vehre@gcc.gnu.org>
+
Backport from trunk:
PR fortran/70842
* gfortran.dg/select_type_35.f03: New test.
Index: gcc/testsuite/gfortran.dg/null_9.f90
===================================================================
--- gcc/testsuite/gfortran.dg/null_9.f90 (nicht existent)
+++ gcc/testsuite/gfortran.dg/null_9.f90 (Arbeitskopie)
@@ -0,0 +1,30 @@
+! { dg-do run }
+
+MODULE fold_convert_loc_ice
+ IMPLICIT NONE
+ PRIVATE
+
+ TYPE, PUBLIC :: ta
+ PRIVATE
+ INTEGER :: a_comp
+ END TYPE ta
+
+ TYPE, PUBLIC :: tb
+ TYPE(ta), ALLOCATABLE :: b_comp
+ END TYPE tb
+
+ PUBLIC :: proc
+CONTAINS
+ SUBROUTINE proc
+ TYPE(tb) :: b
+
+ b = tb(null())
+ if (allocated( b%b_comp )) call abort()
+ END SUBROUTINE proc
+END MODULE fold_convert_loc_ice
+
+ USE fold_convert_loc_ice
+
+ call proc()
+END
+
[-- Attachment #3: submit_gcc-5.diff --]
[-- Type: text/x-patch, Size: 2575 bytes --]
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (Revision 238644)
+++ gcc/fortran/ChangeLog (Arbeitskopie)
@@ -1,6 +1,13 @@
2016-07-22 Andre Vehreschild <vehre@gcc.gnu.org>
Backport from trunk:
+ PR fortran/71807
+ * trans-expr.c (gfc_trans_subcomponent_assign): Special casing
+ when allocatable component is set to null() in initializer.
+
+2016-07-22 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ Backport from trunk:
PR fortran/70842
* simplify.c (gfc_simplify_len): Only for unlimited polymorphic
types replace the expression's _data ref with a _len ref.
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (Revision 238643)
+++ gcc/fortran/trans-expr.c (Arbeitskopie)
@@ -7012,6 +7012,12 @@
tmp = gfc_trans_alloc_subarray_assign (tmp, cm, expr);
gfc_add_expr_to_block (&block, tmp);
}
+ else if (init && cm->attr.allocatable && expr->expr_type == EXPR_NULL)
+ {
+ /* NULL initialization for allocatable components. */
+ gfc_add_modify (&block, dest, fold_convert (TREE_TYPE (dest),
+ null_pointer_node));
+ }
else if (init && (cm->attr.allocatable
|| (cm->ts.type == BT_CLASS && CLASS_DATA (cm)->attr.allocatable
&& expr->ts.type != BT_CLASS)))
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (Revision 238644)
+++ gcc/testsuite/ChangeLog (Arbeitskopie)
@@ -1,6 +1,12 @@
2016-07-22 Andre Vehreschild <vehre@gcc.gnu.org>
Backport from trunk:
+ PR fortran/71807
+ * gfortran.dg/null_9.f90: New test.
+
+2016-07-22 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ Backport from trunk:
PR fortran/70842
* gfortran.dg/select_type_35.f03: New test.
Index: gcc/testsuite/gfortran.dg/null_9.f90
===================================================================
--- gcc/testsuite/gfortran.dg/null_9.f90 (nicht existent)
+++ gcc/testsuite/gfortran.dg/null_9.f90 (Arbeitskopie)
@@ -0,0 +1,30 @@
+! { dg-do run }
+
+MODULE fold_convert_loc_ice
+ IMPLICIT NONE
+ PRIVATE
+
+ TYPE, PUBLIC :: ta
+ PRIVATE
+ INTEGER :: a_comp
+ END TYPE ta
+
+ TYPE, PUBLIC :: tb
+ TYPE(ta), ALLOCATABLE :: b_comp
+ END TYPE tb
+
+ PUBLIC :: proc
+CONTAINS
+ SUBROUTINE proc
+ TYPE(tb) :: b
+
+ b = tb(null())
+ if (allocated( b%b_comp )) call abort()
+ END SUBROUTINE proc
+END MODULE fold_convert_loc_ice
+
+ USE fold_convert_loc_ice
+
+ call proc()
+END
+
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-22 15:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 16:17 [Fortran, Patch, PR71807, v1] [5/6/7 Regression] Internal compiler error with NULL() reference in structure constructor Andre Vehreschild
2016-07-14 17:49 ` Jerry DeLisle
2016-07-15 9:29 ` Andre Vehreschild
2016-07-22 15:21 ` 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).