| Issue |
74097
|
| Summary |
Incorrect DW_AT_decl_file with -gdwarf-5
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
myxoid
|
The value zero for this attribute "indicates that no source file has been specified". DWARF 4 and 5 standards have the same wording here. The typical use-case is for built-in types like `__va_list`.
Similar language exists for source line and column but I have not looked into them.
With `-gdwarf-5`, all versions of Clang I tested (13, 14, 15, 16), incorrectly populate and use file entry `0`.
This breaks the elfutils function `dwarf_decl_file` and anything that uses it.
```
$ cat qq.c
int x;
$ clang-16 -Wall -Wextra -g -c qq.c -o qq.o
$ readelf --debug-dump qq.o | grep -i2 file
DW_AT_type DW_FORM_ref4
DW_AT_external DW_FORM_flag_present
DW_AT_decl_file DW_FORM_data1
DW_AT_decl_line DW_FORM_data1
DW_AT_location DW_FORM_exprloc
--
<20> DW_AT_type : <0x29>
<24> DW_AT_external : 1
<24> DW_AT_decl_file : 0
<25> DW_AT_decl_line : 1
<26> DW_AT_location : (DW_OP_addrx <0>)
--
0 (indirect line string, offset: 0): /tmp
The File Name Table (offset 0x2e, lines 1, columns 3):
Entry Dir MD5 Name
0 0 0xa7134f0f8621a0559890bc8e05fc206 (indirect line string, offset: 0x5): qq.c
$ clang-16 -v
Debian clang version 16.0.6 (11)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/12
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs