This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] fortran/43592
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 30 Apr 2010 12:03:05 -0700
- Subject: [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;