[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-fortran
Subject: Re: [patch,gfortran] PR 24245: ICE with -fdump-parse-tree
From: Steven Bosscher <stevenb () suse ! de>
Date: 2005-10-29 17:42:50
Message-ID: 200510291942.50448.stevenb () suse ! de
[Download RAW message or body]
:REVIEWMAIL:
On Wednesday 12 October 2005 00:10, Erik Edelmann wrote:
> 2005-10-12 Erik Edelmann <erik.edelmann@iki.fi>
>
> PR 24245
> * trans.c (gfc_generate_code): Move code to create a main
> program symbol from here ...
> * parse.c (main_program_symbol): ... to here (new function).
> (accept_statement): Call main_program_symbol from here ...
> (gfc_parse_file): ... and here.
This is not yet OK.
When I wrote this (sorry I broke something with it too ;-) I had this code
here because I knew that we would have parsed some statements already:
+ /* Set the location to the first line of code. */
+ if (ns->code)
+ main_program->declared_at = ns->code->loc;
+ ns->proc_name = main_program;
But in your case, I think ns->code is always NULL, so you're not getting
the declared_at right here. And I wasn't getting it right for an empty
main program. This code was only there because I had no other locus to
work with ;-)
IIUC you add the symbol at parse time, so you can use gfc_current_locus
instead of my hack.
Also, you seem to be calling main_program_symbol twice for the same main
program: Once from accept_statement, and once from gfc_parse_file. It
would be better to only call it from gfc_parse_file. One call can go in
under "case ST_PROGRAM:" and the other one under "default:", which is
where we end up for unnamed main programs. The call from accept_statement
should go away.
Thanks for looking at this bug.
Gr.
Steven
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic