Issue 233674
Summary [AVR] Incorrect debug info generated for aligned stack variable
Labels new issue
Assignees
Reporter benshi001
    For the following a.c

```c++
// a.c
__attribute__((noinline)) int f(void) {
  __attribute__((aligned(8))) int x = 42;
  int y = x + 1;
  return y;
}
```

Built it with commands

```bash
./build/bin/clang --target=avr -O0 -g -c -o a.o a.c
./build/bin/llvm-dwarfdump --debug-info a.o
```

We got
```
0x00000032:     DW_TAG_variable
                  DW_AT_location (DW_OP_fbreg +0)
                  DW_AT_name    ("x")
 DW_AT_alignment       (8)
                  DW_AT_decl_file ("/home/benshi/work/llvm-project/build/a.c")
 DW_AT_decl_line       (2)
                  DW_AT_type    (0x0000004a "int")
```

The location for variable `x` is incorrect, since it's stored at a runtime-aligned part of the stack.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to