* [Patch, fortran] PR fortran/100018 - ICE on missing polymorphic argument
@ 2021-04-10 16:58 José Rui Faustino de Sousa
2021-04-10 17:37 ` Tobias Burnus
0 siblings, 1 reply; 4+ messages in thread
From: José Rui Faustino de Sousa @ 2021-04-10 16:58 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 507 bytes --]
Hi all!
Proposed patch to PR100018 - ICE on missing polymorphic argument.
Patch tested only on x86_64-pc-linux-gnu.
Add association check before de-referencing pointer in order to avoid ICE.
Thank you very much.
Best regards,
José Rui
2021-4-10 José Rui Faustino de Sousa <jrfsousa@gmail.com>
gcc/fortran/ChangeLog:
PR fortran/100018
* resolve.c: Add association check before de-referencing
pointer.
gcc/testsuite/ChangeLog:
PR fortran/100018
* gfortran.dg/PR10018.f90: New test.
[-- Attachment #2: PR10018.patch --]
[-- Type: text/x-patch, Size: 1010 bytes --]
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 1c9b0c5cb62..dd4b26680e0 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -11999,6 +11999,7 @@ start:
/* Assigning a class object always is a regular assign. */
if (code->expr2->ts.type == BT_CLASS
&& code->expr1->ts.type == BT_CLASS
+ && CLASS_DATA (code->expr2)
&& !CLASS_DATA (code->expr2)->attr.dimension
&& !(gfc_expr_attr (code->expr1).proc_pointer
&& code->expr2->expr_type == EXPR_VARIABLE
diff --git a/gcc/testsuite/gfortran.dg/PR10018.f90 b/gcc/testsuite/gfortran.dg/PR10018.f90
new file mode 100644
index 00000000000..f1cf2676f85
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/PR10018.f90
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+subroutine foo(that)
+ implicit none
+ class(*), target, intent(in) :: this
+ class(*), pointer, intent(out) :: that
+
+ that => this
+ return
+end subroutine foo
+! { dg-error "Symbol at \\\(1\\\) is not a DUMMY variable" "" { target "*-*-*" } 5 }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, fortran] PR fortran/100018 - ICE on missing polymorphic argument
2021-04-10 16:58 [Patch, fortran] PR fortran/100018 - ICE on missing polymorphic argument José Rui Faustino de Sousa
@ 2021-04-10 17:37 ` Tobias Burnus
2021-04-10 20:45 ` José Rui Faustino de Sousa
0 siblings, 1 reply; 4+ messages in thread
From: Tobias Burnus @ 2021-04-10 17:37 UTC (permalink / raw)
To: José Rui Faustino de Sousa, fortran, gcc-patches
Hi José,
On 10.04.21 18:58, José Rui Faustino de Sousa via Fortran wrote:
> Proposed patch to PR100018 - ICE on missing polymorphic argument.
> Patch tested only on x86_64-pc-linux-gnu.
LGTM – Thanks for the patch. Two nits:
If you don't want to rely on the author field of git and specify an
extra line, you need a '0' for the moth in the date (-04- instead of -4-).
And you need an additional single-line summary for git – which should be
part of the patch submission.
Tobias
>
> Add association check before de-referencing pointer in order to avoid
> ICE.
>
> Thank you very much.
>
> Best regards,
> José Rui
>
>
> 2021-4-10 José Rui Faustino de Sousa <jrfsousa@gmail.com>
>
> gcc/fortran/ChangeLog:
>
> PR fortran/100018
> * resolve.c: Add association check before de-referencing
> pointer.
>
>
> gcc/testsuite/ChangeLog:
>
> PR fortran/100018
> * gfortran.dg/PR10018.f90: New test.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, fortran] PR fortran/100018 - ICE on missing polymorphic argument
2021-04-10 17:37 ` Tobias Burnus
@ 2021-04-10 20:45 ` José Rui Faustino de Sousa
2021-04-12 13:09 ` Tobias Burnus
0 siblings, 1 reply; 4+ messages in thread
From: José Rui Faustino de Sousa @ 2021-04-10 20:45 UTC (permalink / raw)
To: fortran, gcc-patches
On 10/04/21 17:37, Tobias Burnus wrote:
> And you need an additional single-line summary for git – which should be
> part of the patch submission.
>
Fortran: Fix ICE due to referencing a NULL pointer [PR100018]
gcc/fortran/ChangeLog:
PR fortran/100018
* resolve.c: Add association check before de-referencing
pointer.
gcc/testsuite/ChangeLog:
PR fortran/100018
* gfortran.dg/PR10018.f90: New test.
Thank you very much.
Best regards,
José Rui
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch, fortran] PR fortran/100018 - ICE on missing polymorphic argument
2021-04-10 20:45 ` José Rui Faustino de Sousa
@ 2021-04-12 13:09 ` Tobias Burnus
0 siblings, 0 replies; 4+ messages in thread
From: Tobias Burnus @ 2021-04-12 13:09 UTC (permalink / raw)
To: José Rui Faustino de Sousa, fortran, gcc-patches
On 10.04.21 22:45, José Rui Faustino de Sousa via Fortran wrote:
> On 10/04/21 17:37, Tobias Burnus wrote:
>> And you need an additional single-line summary for git – which should
>> be part of the patch submission.
In case you are waiting for me, I did write:
'LGTM – Thanks for the patch. Two nits:'
and expected that you just fixed them when committing the patch.
(Actually, as they were tiny comments and to the commit log only,
I did not even expect a posting of the committed patch or its commit log.)
But as you didn't commit it it yet, I gathered you are waiting for me.
Hence, you get another LGTM from me :-)
Thanks again for the patch – and the other patches (which still need to
be reviewed).
Tobias
> Fortran: Fix ICE due to referencing a NULL pointer [PR100018]
>
> gcc/fortran/ChangeLog:
>
> PR fortran/100018
> * resolve.c: Add association check before de-referencing
> pointer.
>
>
> gcc/testsuite/ChangeLog:
>
> PR fortran/100018
> * gfortran.dg/PR10018.f90: New test.
>
>
> Thank you very much.
>
> Best regards,
> José Rui
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-12 13:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-10 16:58 [Patch, fortran] PR fortran/100018 - ICE on missing polymorphic argument José Rui Faustino de Sousa
2021-04-10 17:37 ` Tobias Burnus
2021-04-10 20:45 ` José Rui Faustino de Sousa
2021-04-12 13:09 ` Tobias Burnus
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).