public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8224] Fortran: Fix ICE due to referencing a NULL pointer [PR100018]
@ 2021-04-16 16:20 José Rui Faustino de Sousa
  0 siblings, 0 replies; only message in thread
From: José Rui Faustino de Sousa @ 2021-04-16 16:20 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:98c5b5924de969ae8ab37d140aa85bcca3f3c76c

commit r11-8224-g98c5b5924de969ae8ab37d140aa85bcca3f3c76c
Author: José Rui Faustino de Sousa <jrfsousa@gmail.com>
Date:   Fri Apr 16 16:17:21 2021 +0000

    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.

Diff:
---
 gcc/fortran/resolve.c                 |  1 +
 gcc/testsuite/gfortran.dg/PR10018.f90 | 11 +++++++++++
 2 files changed, 12 insertions(+)

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] only message in thread

only message in thread, other threads:[~2021-04-16 16:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 16:20 [gcc r11-8224] Fortran: Fix ICE due to referencing a NULL pointer [PR100018] José Rui Faustino de Sousa

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).