This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] fortran/43592


The ChangeLog and patch are self-explanatory.  Regression
tested on i686-*-freebsd.

2010-04-30  Steven G. Kargl  <kargl@gcc.gnu.org>

	* PR fortran/43592
	fortran/parse.c (parse_interface): Do not dereference a NULL pointer.

2010-04-30  Steven G. Kargl  <kargl@gcc.gnu.org>

	* PR fortran/43592
	gfortran.dg/unexpected_interface.f90: New test.

-- 
Steve
Index: testsuite/gfortran.dg/unexpected_interface.f90
===================================================================
--- testsuite/gfortran.dg/unexpected_interface.f90	(revision 0)
+++ testsuite/gfortran.dg/unexpected_interface.f90	(revision 0)
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/43592
+! Original code submitted by Joost VandeVondele
+! Dejagnu-ification by Steven G. Kargl
+! 
+ interface assignment (=)
+  interface pseudo_scalar  ! { dg-error "Unexpected INTERFACE statement" }
+  pure function double_tensor2odd (x, t2) result (xt2)
+! { dg-error "Unexpected end of file" "" { target "*-*-*" } 0 }
Index: fortran/parse.c
===================================================================
--- fortran/parse.c	(revision 158911)
+++ fortran/parse.c	(working copy)
@@ -2264,9 +2264,9 @@ loop:
     {
       if (current_state == COMP_NONE)
 	{
-	  if (new_state == COMP_FUNCTION)
+	  if (new_state == COMP_FUNCTION && sym)
 	    gfc_add_function (&sym->attr, sym->name, NULL);
-	  else if (new_state == COMP_SUBROUTINE)
+	  else if (new_state == COMP_SUBROUTINE && sym)
 	    gfc_add_subroutine (&sym->attr, sym->name, NULL);
 
 	  current_state = new_state;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]