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

            Bug ID: 102442
           Summary: Incorrect debug info for C89-style function parameter
           Product: gcc
           Version: 11.1.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.1.0 with gdb (Ubuntu 20.04.2)

(terminal) $ cat simple.c && gcc -g -Og simple.c
#include <assert.h>

// float fx(float x)
float fx(x) float x;
{
    return x + 1.0;
}

float inita() { return 3.0; }

int main()
{
    float a = inita();
    assert(fx(a) == 4.0);
}
--------------------

(terminal) $ cat run.gdb
b fx
r

(terminal) $ gdb -x run.gdb a.out
Breakpoint 1, fx (x=0) at simple.c:5 <- **BUG** <- x should be 3.0

Reply via email to