This is the mail archive of the gcc-bugs@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]

[Bug fortran/54224] Warn for unused internal procedures


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54224

--- Comment #28 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #27)
> > At some moment, the Fortran FE sets DECL_SOURCE_LOCATION() on a tree,
> > probably using loc->lb->line. Finding out where this happens probably
> > requires a bit of debugging.
> 
> /* Set the backend source location of a decl.  */
> 
> void
> gfc_set_decl_location (tree decl, locus * loc)
> {
>   DECL_SOURCE_LOCATION (decl) = loc->lb->location;
> }
> 
> in gcc/fortran/trans-decl.c?

I guess you can always try, but yes it looks one place that could be fixed. I
suggest to add a wrapper function. Something like:

location_t
gfc_location_from_locus (const locus * loc)
{
        unsigned int offset = loc->nextc - loc->lb->line;
        return linemap_position_for_loc_and_offset (line_table,
                                                        loc->lb->location,
                                                        offset));
}

I think there is at least one place already that could use this wrapper.

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