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

            Bug ID: 128485
           Summary: [RX] Incorrect DWARF variable location offset (4
                    bytes) due to CFA calculation mismatch in prologue
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: yoshinori.sato at nifty dot com
  Target Milestone: ---

When compiling for the RX target under specific conditions (e.g., using
-fomit-frame-pointer with a mix of register-passed and stack-passed arguments),
the generated DWARF debugging information for variable locations is offset by 4
bytes relative to their actual memory layout.

Consequently, when debugging with GDB, the values of local variables and
arguments are displayed incorrectly, often showing the value of an adjacent
variable or uninitialized memory.

It can be reproduced using the following method.
code.
int foo(int a, int b, int c, int d)
{
        return a + b + c - d;
}

int main(int argc, char *argv[])
{
        return foo(1, 2, 3, 4);
}

build on "rx-elf-gcc -g -fomit-frame-pointer test.c"
run as "rx-elf-gdb" and show arguments.
Breakpoint 1, main (argc=0, argv=0x0 <_preinit_array_start>) at argtest.c:8
8               return foo(1, 2, 3, 4);
(gdb) s
foo (a=0, b=1, c=2, d=3) at argtest.c:3
3               return a + b + c - d;

The arguments for `foo` are shifted by one.
  • [Bug target/128485] New: [RX]... yoshinori.sato at nifty dot com via Gcc-bugs

Reply via email to