Re: [Patch, fortran] PR fortran/100018 - ICE on missing polymorphic argument

2021-04-12 Thread Tobias Burnus

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


Re: [Patch, fortran] PR fortran/100018 - ICE on missing polymorphic argument

2021-04-10 Thread José Rui Faustino de Sousa via 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


Re: [Patch, fortran] PR fortran/100018 - ICE on missing polymorphic argument

2021-04-10 Thread Tobias Burnus

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 

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.



[Patch, fortran] PR fortran/100018 - ICE on missing polymorphic argument

2021-04-10 Thread José Rui Faustino de Sousa via Gcc-patches

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  

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 --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 000..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 }