[fortran] Add NULL check before checking interfaces
diff mbox series

Message ID cfc36137-cf4e-446c-df14-f332ffc4f5f4@netcologne.de
State New
Headers show
Series
  • [fortran] Add NULL check before checking interfaces
Related show

Commit Message

Thomas Koenig Dec. 8, 2019, 1:04 p.m. UTC
Hello world,

the attached patch fixes an ICE where a NULL check was missing.
Committed as obvious and simple after regression-testing as
r279087.

Since this is an ICE after an error has already been emitted,
I don't see any particular need to backport.

Regards

	Thomas

2018-12-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/92764
	* interface.c (gfc_procedure_use): Check for existence of derived
	component before using (twice).

2018-12-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/92764
	* gfortran.dg/interface_44.f90: New test.

Patch
diff mbox series

Index: interface.c
===================================================================
--- interface.c	(Revision 279064)
+++ interface.c	(Arbeitskopie)
@@ -3888,6 +3888,7 @@  gfc_procedure_use (gfc_symbol *sym, gfc_actual_arg
 	  /* F2008, C1303 and C1304.  */
 	  if (a->expr
 	      && (a->expr->ts.type == BT_DERIVED || a->expr->ts.type == BT_CLASS)
+	      && a->expr->ts.u.derived
 	      && ((a->expr->ts.u.derived->from_intmod == INTMOD_ISO_FORTRAN_ENV
 		   && a->expr->ts.u.derived->intmod_sym_id == ISOFORTRAN_LOCK_TYPE)
 		  || gfc_expr_attr (a->expr).lock_comp))
@@ -3901,6 +3902,7 @@  gfc_procedure_use (gfc_symbol *sym, gfc_actual_arg
 
 	  if (a->expr
 	      && (a->expr->ts.type == BT_DERIVED || a->expr->ts.type == BT_CLASS)
+	      && a->expr->ts.u.derived
 	      && ((a->expr->ts.u.derived->from_intmod == INTMOD_ISO_FORTRAN_ENV
 		   && a->expr->ts.u.derived->intmod_sym_id
 		      == ISOFORTRAN_EVENT_TYPE)