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

            Bug ID: 108615
           Summary: Incorrect prologue marker in line table
           Product: gcc
           Version: 10.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ Filing FTR, to link a commit to a test-case that it fixes, and to be able to
refer to it from gdb sources. ]

Consider pck.adb/pck.ads from here (
https://sourceware.org/git/?p=binutils-gdb.git;a=tree;f=gdb/testsuite/gdb.ada/ref_param;h=823556d8928bd1de865e71400092e6a44b2773cd;hb=HEAD
).

Compile like so, with system gcc 7.5.0:
...
$ gcc pck.adb -S -g
...

In the .s file we find:
...
pck__call_me:
.LFB3:
        .file 1 "pck.adb"
        .loc 1 18 0
        .cfi_startproc
        .loc 1 18 0
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        movq    %rdi, -8(%rbp)
        .loc 1 20 0
...

There's a convention that the second entry in the line table indicates the end
of the prologue.

So the second .loc indicates that the prologue ends there, while it ends only
after the third insn, at line 20.

Same with 10.4.0.

Fixed by commit c029fcb5680 ("Reset force_source_line in final.c"), first
available in release 11.1.0.

With 11.3.0 we have:
...
pck__call_me:
.LFB3:
        .file 1 "pck.adb"
        .loc 1 18 4
        .cfi_startproc
        pushq   %rbp
        .cfi_def_cfa_offset 16
        .cfi_offset 6, -16
        movq    %rsp, %rbp
        .cfi_def_cfa_register 6
        movq    %rdi, -8(%rbp)
        .loc 1 20 16
...

Reply via email to