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] PR38152: procedure pointers as module variables


Hi all,

here is a one-line fix for a problem with proc_ptr_13.f90 I discovered
today. The test case works as long as it is not compiled with "-g"
(which results in a segfault).
Regression-tested on x86_64-unknown-linux-gnu. Ok for trunk?

Should I also backport this to 4.4? If yes, would this be possible
before the release, or should I wait? It definitely is a regression
(in the way that 4.3 gave a "not implemented" message, while 4.4 gives
an ICE).

Cheers,
Janus


2009-04-07  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/38152
	* trans-decl.c (gfc_get_symbol_decl): Correctly set decl location for
	procedure pointer decls.


2009-04-07  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/38152
	* gfortran.dg/proc_ptr_13.f90: Add "-g" option.
Index: gcc/testsuite/gfortran.dg/proc_ptr_13.f90
===================================================================
--- gcc/testsuite/gfortran.dg/proc_ptr_13.f90	(Revision 145668)
+++ gcc/testsuite/gfortran.dg/proc_ptr_13.f90	(Arbeitskopie)
@@ -1,4 +1,5 @@
 ! { dg-do compile }
+! { dg-options "-g" }
 !
 ! PR 38152: Procedure pointers as module variables.
 !
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c	(Revision 145668)
+++ gcc/fortran/trans-decl.c	(Arbeitskopie)
@@ -1015,10 +1015,12 @@ gfc_get_symbol_decl (gfc_symbol * sym)
   if (sym->backend_decl)
     return sym->backend_decl;
 
-  /* Catch function declarations.  Only used for actual parameters.  */
+  /* Catch function declarations.  Only used for actual parameters and
+     procedure pointers.  */
   if (sym->attr.flavor == FL_PROCEDURE)
     {
       decl = gfc_get_extern_function_decl (sym);
+      gfc_set_decl_location (decl, &sym->declared_at);
       return decl;
     }
 

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