[PATCH][fortran] Use a TRANSLATION_UNIT_DECL for DECL_CONTEXT

Richard Guenther rguenther@suse.de
Mon Oct 4 09:20:00 GMT 2010


On Sat, 2 Oct 2010, Mikael Morin wrote:

> On Wednesday 29 September 2010 15:16:30 Richard Guenther wrote:
> > On Fri, 24 Sep 2010, Richard Guenther wrote:
> > > On Wed, 22 Sep 2010, Steven Bosscher wrote:
> > > > On Wed, Sep 22, 2010 at 1:08 PM, Richard Guenther <rguenther@suse.de> 
> wrote:
> > > > > On Fri, 17 Sep 2010, Richard Guenther wrote:
> > > > >> This transitions the Fortran frontend to use a TRANSLATION_UNIT_DECL
> > > > >> for DECL_CONTEXT of global entities.  This will allow LTO to produce
> > > > >> proper language specific debug information.
> > > > >> 
> > > > >> The patch leaves some DECL_CONTEXT tests for NULL untouched, as the
> > > > >> FE seems to have both test-for-globalness and
> > > > >> test-for-not-yet-initialized tests - I'd appreciate if somebody
> > > > >> could go over those in the Frontend and use DECL_FILE_SCOPE_P for
> > > > >> those that really mean it.
> > > > >> 
> > > > >> I'm also somewhat confused about binding-level use - for modules
> > > > >> its state seems to be strange.  Maybe somebody can shed a light
> > > > >> on this.  (Possibly module decls want to use a different T_U_D
> > > > >> in the future as well)
> > > > >> 
> > > > >> As of the ???s in the patch:
> > > > >> 
> > > > >>   /* Create the variable.  */
> > > > >>   pushdecl (decl);
> > > > >>   /* Why is current_binding_level == global_binding_level here?
> > > > >>   gcc_assert (DECL_CONTEXT (decl) == NULL_TREE);  */
> > > > >>   gcc_assert (sym->ns->proc_name->attr.flavor == FL_MODULE);
> > > > >>   DECL_CONTEXT (decl) = sym->ns->proc_name->backend_decl;
> > > > >> 
> > > > >> this (and the other two similar cases) seems to assert that
> > > > >> pushdecl doesn't set DECL_CONTEXT (well, before my patch
> > > > >> it set it to current_function_decl which is NULL).  So, does
> > > > >> this check that the decl is at file-scope or does it want to
> > > > >> test that current_function_decl is NULL?
> > > > >> 
> > > > >> Bootstrap and regtest re-running after some minor changes on
> > > > >> x86_64-unknown-linux-gnu.  Any idea about the above?
> > > > > 
> > > > > Ping.
> > > > 
> > > > The whole module stuff looks just wrong, but it's not worse or better
> > > > before or after the patch. And your patch is a valid cleanup So OK.
> > > > 
> > > > If I can find a clone of me, I'll put him to work to figure out what's
> > > > going on in the places you marked with "???"...
> > > 
> > > Ok, so the following patch simply removes the asserts on DECL_CONTEXT
> > > when it is set to sth else in the following statement.
> > > 
> > > Bootstrap & regtest state shouldn't have changed with that change,
> > > but I'll re-bootstrap and test before committing.
> > > 
> > > The patch still allows you to debug Fortran code with Fortran
> > > languge when using LTO.
> > > 
> > > Thus, ok for trunk?
> > 
> > Ping.
> 
> Steven already approved the previous version of the patch, and this version 
> has just the ??? comments removed (as far as I know) so I guess you can 
> commit. 
> I didn't see anything clearly wrong in the patch, but honestly I can't tell 
> whether it's good or bad. 
> OK.

Ah, I didn't recognize Stevens comment as approval.

Bootstrapped and tested on x86_64-unknown-linux-gnu, committed
as rev 164928.

Thanks,
Richard.



More information about the Fortran mailing list