[Bug ada/101575] [gcc-11, -gdwarf-4] Missing .file <n> directive causes invalid line info

bernd.edlinger at hotmail dot de gcc-bugzilla@gcc.gnu.org
Fri Jul 23 12:22:22 GMT 2021


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

--- Comment #8 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
I can of course make the .loc go away. If you really want that.

It is basically the DECL_SOURCE_LOCATION of an
otherwise ignored decl.  If the DECL_SOURCE_LOCATION
is UNKNOWN_LOCATION the function should have no line info,
and gdb should be able not to step into this function.

However the location does not look really wrong to me.
In create_subprog_decl it is taken over from input_location.
I could imagine that this is sometimes a misleading location.
But then in gnat_pushdecl we have
Sloc_to_locus (Sloc (gnat_node), &DECL_SOURCE_LOCATION (decl));
and it is again the same location.

In the test case the location points here:

        +---------------------------- column location
        v
   type Struct1 is limited record  <- line location
      X : Integer := 13;
      Y : Integer := 19;
   end record;


More information about the Gcc-bugs mailing list