public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran] Add NULL check before checking interfaces
@ 2019-12-08 13:04 Thomas Koenig
  0 siblings, 0 replies; only message in thread
From: Thomas Koenig @ 2019-12-08 13:04 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 554 bytes --]

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.

[-- Attachment #2: p1.diff --]
[-- Type: text/x-patch, Size: 929 bytes --]

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)

[-- Attachment #3: interface_44.f90 --]
[-- Type: text/x-fortran, Size: 183 bytes --]

! { dg-do compile }
! PR 92964 - this used to ICE.
! Original test case by Arseny Solokha
type(e6) function dn() ! { dg-error "The type for function" }
  call sub(dn)
end function dn

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-12-08 13:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-08 13:04 [patch, fortran] Add NULL check before checking interfaces Thomas Koenig

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