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

            Bug ID: 90422
           Summary: DW_AT_main_subprogram not added to CU DIE
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

In the DWARF-4 standard, we find:
...
3.1.1 Normal and Partial Compilation Unit Entries
11. A DW_AT_main_subprogram attribute, which is a flag whose presence indicates
that the compilation unit contains a subprogram that has been identified as the
starting function of the program. 
...
and:
...
3.3 Subroutine and Entry Point Entries
A subroutine entry may contain a DW_AT_main_subprogram attribute which is a
flag whose presence indicates that the subroutine has been identified as the
starting function of the program.
...

In dwarf2out.c, we only add the attribute to the subprogram DIE:
...
      if (dwarf_version >= 4 || !dwarf_strict)
        add_AT_flag (subr_die, DW_AT_main_subprogram, 1);
...
but not to the CU DIE.

Reply via email to