* [PATCH, Fortran, 29229, v1] [7 Regression] ICE in gfc_trans_assignment_1 with -fcheck=mem
@ 2017-02-07 7:31 Andre Vehreschild
2017-02-19 16:42 ` [Ping, PATCH, Fortran, 79229, " Andre Vehreschild
0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2017-02-07 7:31 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 392 bytes --]
Hi all,
attached patch fixes the issue of 79229 (which is not a regression).
The issue was that the code generating the checking was expecting a
pointer type, but got an indirect ref to it. This is fixed now.
Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk?
Regards,
Andre
--
Andre Vehreschild * Kreuzherrenstr. 8 * 52062 Aachen
Tel.: +49 241 9291018 * Email: vehre@gmx.de
[-- Attachment #2: pr79229_v1.clog --]
[-- Type: text/plain, Size: 375 bytes --]
gcc/testsuite/ChangeLog:
2017-02-07 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/79229
* gfortran.dg/class_allocate_24.f90: New test.
gcc/fortran/ChangeLog:
2017-02-07 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/79229
* trans-expr.c (gfc_trans_assignment_1): Deref indirect refs when
compiling with -fcheck=mem to check the pointer and not the data.
[-- Attachment #3: pr79229_v1.patch --]
[-- Type: text/x-patch, Size: 1503 bytes --]
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 138af56..fcd6f16 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -9959,13 +9959,16 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
tree cond;
const char* msg;
+ tmp = INDIRECT_REF_P (lse.expr)
+ ? gfc_build_addr_expr (NULL_TREE, lse.expr) : lse.expr;
+
/* We should only get array references here. */
- gcc_assert (TREE_CODE (lse.expr) == POINTER_PLUS_EXPR
- || TREE_CODE (lse.expr) == ARRAY_REF);
+ gcc_assert (TREE_CODE (tmp) == POINTER_PLUS_EXPR
+ || TREE_CODE (tmp) == ARRAY_REF);
/* 'tmp' is either the pointer to the array(POINTER_PLUS_EXPR)
or the array itself(ARRAY_REF). */
- tmp = TREE_OPERAND (lse.expr, 0);
+ tmp = TREE_OPERAND (tmp, 0);
/* Provide the address of the array. */
if (TREE_CODE (lse.expr) == ARRAY_REF)
diff --git a/gcc/testsuite/gfortran.dg/class_allocate_24.f90 b/gcc/testsuite/gfortran.dg/class_allocate_24.f90
new file mode 100644
index 0000000..883247d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_allocate_24.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-fcheck=mem" }
+!
+! Compile time check only, to test that the ICE is fixed in the assignment of the
+! default initializer of the class to sf.
+
+implicit none
+
+type :: t
+ integer, pointer :: data => null ()
+end type
+
+class(t), dimension(:), allocatable :: sf
+allocate (t :: sf (1))
+end
+
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Ping, PATCH, Fortran, 79229, v1] [7 Regression] ICE in gfc_trans_assignment_1 with -fcheck=mem
2017-02-07 7:31 [PATCH, Fortran, 29229, v1] [7 Regression] ICE in gfc_trans_assignment_1 with -fcheck=mem Andre Vehreschild
@ 2017-02-19 16:42 ` Andre Vehreschild
2017-02-19 16:58 ` Jerry DeLisle
0 siblings, 1 reply; 4+ messages in thread
From: Andre Vehreschild @ 2017-02-19 16:42 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 488 bytes --]
Ping!
this time with correct PR number: 79229.
On Tue, 7 Feb 2017 08:31:22 +0100
Andre Vehreschild <vehre@gmx.de> wrote:
> Hi all,
>
> attached patch fixes the issue of 79229 (which is not a regression).
> The issue was that the code generating the checking was expecting a
> pointer type, but got an indirect ref to it. This is fixed now.
>
> Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk?
>
> Regards,
> Andre
--
Andre Vehreschild * Email: vehre ad gmx dot de
[-- Attachment #2: pr79229_v1.clog --]
[-- Type: text/plain, Size: 375 bytes --]
gcc/testsuite/ChangeLog:
2017-02-07 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/79229
* gfortran.dg/class_allocate_24.f90: New test.
gcc/fortran/ChangeLog:
2017-02-07 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/79229
* trans-expr.c (gfc_trans_assignment_1): Deref indirect refs when
compiling with -fcheck=mem to check the pointer and not the data.
[-- Attachment #3: pr79229_v1.patch --]
[-- Type: text/x-patch, Size: 1503 bytes --]
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 138af56..fcd6f16 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -9959,13 +9959,16 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
tree cond;
const char* msg;
+ tmp = INDIRECT_REF_P (lse.expr)
+ ? gfc_build_addr_expr (NULL_TREE, lse.expr) : lse.expr;
+
/* We should only get array references here. */
- gcc_assert (TREE_CODE (lse.expr) == POINTER_PLUS_EXPR
- || TREE_CODE (lse.expr) == ARRAY_REF);
+ gcc_assert (TREE_CODE (tmp) == POINTER_PLUS_EXPR
+ || TREE_CODE (tmp) == ARRAY_REF);
/* 'tmp' is either the pointer to the array(POINTER_PLUS_EXPR)
or the array itself(ARRAY_REF). */
- tmp = TREE_OPERAND (lse.expr, 0);
+ tmp = TREE_OPERAND (tmp, 0);
/* Provide the address of the array. */
if (TREE_CODE (lse.expr) == ARRAY_REF)
diff --git a/gcc/testsuite/gfortran.dg/class_allocate_24.f90 b/gcc/testsuite/gfortran.dg/class_allocate_24.f90
new file mode 100644
index 0000000..883247d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/class_allocate_24.f90
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-fcheck=mem" }
+!
+! Compile time check only, to test that the ICE is fixed in the assignment of the
+! default initializer of the class to sf.
+
+implicit none
+
+type :: t
+ integer, pointer :: data => null ()
+end type
+
+class(t), dimension(:), allocatable :: sf
+allocate (t :: sf (1))
+end
+
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Ping, PATCH, Fortran, 79229, v1] [7 Regression] ICE in gfc_trans_assignment_1 with -fcheck=mem
2017-02-19 16:42 ` [Ping, PATCH, Fortran, 79229, " Andre Vehreschild
@ 2017-02-19 16:58 ` Jerry DeLisle
2017-02-19 18:44 ` Andre Vehreschild
0 siblings, 1 reply; 4+ messages in thread
From: Jerry DeLisle @ 2017-02-19 16:58 UTC (permalink / raw)
To: Andre Vehreschild, fortran, gcc-patches
On 02/19/2017 08:42 AM, Andre Vehreschild wrote:
> Ping!
>
> this time with correct PR number: 79229.
>
> On Tue, 7 Feb 2017 08:31:22 +0100
> Andre Vehreschild <vehre@gmx.de> wrote:
>
>> Hi all,
>>
>> attached patch fixes the issue of 79229 (which is not a regression).
>> The issue was that the code generating the checking was expecting a
>> pointer type, but got an indirect ref to it. This is fixed now.
>>
>> Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk?
>>
>> Regards,
>> Andre
>
>
This is OK,
Jerry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Ping, PATCH, Fortran, 79229, v1] [7 Regression] ICE in gfc_trans_assignment_1 with -fcheck=mem
2017-02-19 16:58 ` Jerry DeLisle
@ 2017-02-19 18:44 ` Andre Vehreschild
0 siblings, 0 replies; 4+ messages in thread
From: Andre Vehreschild @ 2017-02-19 18:44 UTC (permalink / raw)
To: Jerry DeLisle; +Cc: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 796 bytes --]
Hi Jerry, hi all,
thanks for the review. Committed as r245581.
Regards,
Andre
On Sun, 19 Feb 2017 08:58:46 -0800
Jerry DeLisle <jvdelisle@charter.net> wrote:
> On 02/19/2017 08:42 AM, Andre Vehreschild wrote:
> > Ping!
> >
> > this time with correct PR number: 79229.
> >
> > On Tue, 7 Feb 2017 08:31:22 +0100
> > Andre Vehreschild <vehre@gmx.de> wrote:
> >
> >> Hi all,
> >>
> >> attached patch fixes the issue of 79229 (which is not a regression).
> >> The issue was that the code generating the checking was expecting a
> >> pointer type, but got an indirect ref to it. This is fixed now.
> >>
> >> Bootstraps and regtests ok on x86_64-linux/f25. Ok for trunk?
> >>
> >> Regards,
> >> Andre
> >
> >
>
> This is OK,
>
> Jerry
--
Andre Vehreschild * Email: vehre ad gmx dot de
[-- Attachment #2: submit.diff --]
[-- Type: text/x-patch, Size: 2481 bytes --]
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (Revision 245580)
+++ gcc/fortran/ChangeLog (Arbeitskopie)
@@ -7,6 +7,12 @@
2017-02-19 Andre Vehreschild <vehre@gcc.gnu.org>
+ PR fortran/79229
+ * trans-expr.c (gfc_trans_assignment_1): Deref indirect refs when
+ compiling with -fcheck=mem to check the pointer and not the data.
+
+2017-02-19 Andre Vehreschild <vehre@gcc.gnu.org>
+
PR fortran/79335
* trans-array.c (duplicate_allocatable_coarray): Ensure attributes
passed are properly initialized.
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c (Revision 245580)
+++ gcc/fortran/trans-expr.c (Arbeitskopie)
@@ -9961,13 +9961,16 @@
tree cond;
const char* msg;
+ tmp = INDIRECT_REF_P (lse.expr)
+ ? gfc_build_addr_expr (NULL_TREE, lse.expr) : lse.expr;
+
/* We should only get array references here. */
- gcc_assert (TREE_CODE (lse.expr) == POINTER_PLUS_EXPR
- || TREE_CODE (lse.expr) == ARRAY_REF);
+ gcc_assert (TREE_CODE (tmp) == POINTER_PLUS_EXPR
+ || TREE_CODE (tmp) == ARRAY_REF);
/* 'tmp' is either the pointer to the array(POINTER_PLUS_EXPR)
or the array itself(ARRAY_REF). */
- tmp = TREE_OPERAND (lse.expr, 0);
+ tmp = TREE_OPERAND (tmp, 0);
/* Provide the address of the array. */
if (TREE_CODE (lse.expr) == ARRAY_REF)
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (Revision 245580)
+++ gcc/testsuite/ChangeLog (Arbeitskopie)
@@ -1,3 +1,8 @@
+2017-02-19 Andre Vehreschild <vehre@gcc.gnu.org>
+
+ PR fortran/79229
+ * gfortran.dg/class_allocate_24.f90: New test.
+
2017-02-19 Paul Thomas <pault@gcc.gnu.org>
PR fortran/79402
Index: gcc/testsuite/gfortran.dg/class_allocate_24.f90
===================================================================
--- gcc/testsuite/gfortran.dg/class_allocate_24.f90 (nicht existent)
+++ gcc/testsuite/gfortran.dg/class_allocate_24.f90 (Arbeitskopie)
@@ -0,0 +1,16 @@
+! { dg-do compile }
+! { dg-options "-fcheck=mem" }
+!
+! Compile time check only, to test that the ICE is fixed in the assignment of the
+! default initializer of the class to sf.
+
+implicit none
+
+type :: t
+ integer, pointer :: data => null ()
+end type
+
+class(t), dimension(:), allocatable :: sf
+allocate (t :: sf (1))
+end
+
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-02-19 18:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-07 7:31 [PATCH, Fortran, 29229, v1] [7 Regression] ICE in gfc_trans_assignment_1 with -fcheck=mem Andre Vehreschild
2017-02-19 16:42 ` [Ping, PATCH, Fortran, 79229, " Andre Vehreschild
2017-02-19 16:58 ` Jerry DeLisle
2017-02-19 18:44 ` 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).