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

            Bug ID: 103047
           Summary: Inconsist arguments ordering for inlined subroutine
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: liyd2021 at gmail dot com
  Target Milestone: ---

Affected versions: gcc 11.2.0 with gdb (Ubuntu 20.04.2)

The `foo` function is inlined in O1 optimization, and gcc generates inconsist 
arguments ordering between `DW_TAG_inlined_subroutine` and `DW_TAG_subprogram`
in debug information.
This bug can also be reproduced in gcc 7, 8, 9.

(terminal) $ cat a.c && gcc -g -O1 a.c
int foo(int a0, double a1)
{
  return a0 != 0 || a1 != 1.0;
}

int v0 = 0;
double v1 = 1.0;

int main()
{
  return foo(v0, v1);
}
--------------------
(terminal) $ cat run.gdb
ptype foo
b foo
r
ptype foo
--------------------
(terminal) $ gdb -x run.gdb a.out
type = int (int, double)
Breakpoint 1 at 0x401169: foo. (2 locations)

Breakpoint 1, foo (a1=1, a0=0) at a.c:3
3         return a0 != 0 || a1 != 1.0;
type = int (double, int) <-- inconsist with previous print

Reply via email to