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]

Re: [Patch, Fortran] PR 44430: [4.5/4.6 Regression] Infinite recursion with -fdump-parse-tree


Hello,

On 07.06.2010 04:53, Janus Weil wrote:
Hi all,

here is the fix for a regression introduced by one of my procedure
pointer patches last year (r149586). One of the things this patch did
was to give a formal_ns to all procedures (before that, the formal_ns
field was only used for interfaces, I think). Now this creates a
problem for -fdump-parse-tree if the formal_ns coincides with the
local namespace of the procedure (which is usually the case for normal
functions and subroutines): Dumping the procedure symbol includes
dumping the formal_ns, which again contains the procedure symbol, so
that we end up in an infinite loop. My fix avoids this by checking if
the formal_ns is the same as the procedure ns.
I'm not sure this is right.
from gfc_symbol in gfortran.h :
  struct gfc_namespace *ns;	/* namespace containing this symbol */

IIUC, ns is the parent namespace and formal_ns the local namespace. I don't see how they could be the same.


30 minutes later ...


OK, the symbols are the same, and thus their namespaces are the same.
It would be more obvious from my point of view to test sym against sym->ns->proc_name instead of their namespaces.
OK with that change





The patch was regtested on x86_64-unknown-linux-gnu without failures. Ok for trunk and 4.5?

Also: Should I include a test case when committing this patch? And if
yes, what should it look like? I haven't found any test cases for
-fdump-parse-tree in the test suite ...
A { dg-do compile } testcase with { dg-options -fdump-parse-tree } would timeout without the patch, right ?


Cheers, Janus


2010-06-06 Janus Weil<janus@gcc.gnu.org>


	PR fortran/44430
	* dump-parse-tree.c (show_symbol): Avoid infinite loop.

Thanks for the patch. Mikael


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