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F283qYt95j3N2gTM_4bSOssdiS-U7iXU2Od5Npp-QHP86PfYMfVMc1vOcop_6_fOo8PUePbhLWZXE0hfrUcOWGuHRC6IJRbdUSP8JsSUNl23dSfmCmEUbAE6g4k9luxa_AHl47OSBEWCQV5gBu91ZW_7H2OCICi5CgiEggDgdBmZ3F_PtNWmU4zfa7DxWJsxwCmAWYgI0EJgeGXfGcIWwjbPO-Zjv0O0Iq--DiQ60WLc9FB8AxaMNpXeXH70BOx5bjY4NsX0BYDZgVrxC27PgGCePTg-IMl6mcMVY9rSqENp6njPb4WvdZq_5i9EM-bJonhJJO8Ua2OPBhB9Z6xnR1um2Bck7Q5ZQYrDmCtjiEO3HJuSNB1leIA4iE-QOtYi9Ya4cuGkaHvuB35BRVICWv13-iRdBEACRQUUjHjnr1r38CC5oLVcKD4jinvCDJQjEyUDyxWKcgIEk7SnPFiZMZf300JhZP3S5WEm-l3m-bAfp0oJJfowbow06-VZ3sgKuGUqHXVVQiaAPZthxBkusb6WwD-Hf1KGnlkj5wYZ5rlWOq0VczeM5HdPONdosPt_--kI3dtwZuWicay022egezjX8vHbllOkNfOC_xO4xAZD5N2fgzXthbccxqdM4zOJxs6hpHmS04pTN5zyZMzbjMx7mjKbhrOZlOYbE4dIuRukNtI2KQ00IVWtsIelq_OMWiAX-3wdhGIVZEsbZNKuTKK_zKog5LZMqHCUBh6jKKcqZarMem4UX6aszCaSwzh4nqfUogXuDwUInnPQf_l8cRvAVV_EJV5GuyO9gEP6S7wNmSQURhBbYd2nohw6nj1GDqe_c6LFfyMKv4h9kFcbN>53163</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[DWARF][DebugInfo] Missing variables due to clang setting type size to zero
</td>
</tr>
<tr>
<th>Labels</th>
<td>
debuginfo
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
OCHyams
</td>
</tr>
</table>
<pre>
clang built with 968be05b8fdc1d23c055cc4963230a89efbc5967 (2022-01-12)
Target: x86_64-unknown-linux-gnu
Clang sometimes emits DW_TAG_base_type DIEs with the attribute DW_AT_byte_size set to 0. This is observable when enabling DWARFv5 in the following reproducer. Look at the DIE for DW_ATE_unsigned_1 (0x00000023) which is used in the location expression for `b` (0x0000004e) as part of a conversion (DW_OP_convert).
```
$ cat ex.cpp
__attribute__((optnone))
void ext(bool) {}
__attribute__((noinline))
void fun(bool b) {
ext(b);
}
int main() {
fun(true);
return 0;
}
$ clang -c -O2 -gdwarf-5 ex.cpp -o ex.o
$ llvm-dwarfdump test.o
0x00000023: DW_TAG_base_type
DW_AT_name ("DW_ATE_unsigned_1")
DW_AT_encoding (DW_ATE_unsigned)
DW_AT_byte_size (0x00)
0x00000027: DW_TAG_base_type
DW_AT_name ("DW_ATE_unsigned_8")
DW_AT_encoding (DW_ATE_unsigned)
DW_AT_byte_size (0x01)
<snip>
0x00000042: DW_TAG_subprogram
DW_AT_low_pc (0x00000000004004b0)
DW_AT_high_pc (0x00000000004004b5)
DW_AT_frame_base (DW_OP_reg7 RSP)
DW_AT_call_all_calls (true)
DW_AT_linkage_name ("_Z3funb")
DW_AT_name ("fun")
DW_AT_decl_file ("/home/och/dev/bugs/scratch/ex.cpp")
DW_AT_decl_line (4)
DW_AT_external (true)
0x0000004e: DW_TAG_formal_parameter
DW_AT_location (DW_OP_breg5 RDI+0, DW_OP_constu 0xffffffff, DW_OP_and, DW_OP_convert (0x00000023) "DW_ATE_unsigned_1", DW_OP_convert (0x00000027) "DW_ATE_unsigned_8", DW_OP_stack_value)
DW_AT_name ("b")
DW_AT_decl_file ("/home/och/dev/bugs/scratch/ex.cpp")
DW_AT_decl_line (4)
DW_AT_type (0x0000009a "bool")
```
lldb says the variable is unavailable and helpfully reports "Unsupported type size in DW_OP_convert":
```
__attribute__((optnone))
void ext(bool) {}
__attribute__((noinline))
void fun(bool b) {
ext(b);
}
int main() {
fun(true);
return 0;
}
$ clang -O2 -gdwarf-5 ex.cpp -o ex
$ lldb ex
~/dev/bugs/scratch$ lldb ex
(lldb) target create "ex"
Current executable set to '/home/och/dev/bugs/scratch/ex' (x86_64).
(lldb) b fun
Breakpoint 1: where = ex`fun(bool) at ex.cpp:5:3, address = 0x00000000004004b0
(lldb) run
Process 6295 launched: '/home/och/dev/bugs/scratch/ex' (x86_64)
Process 6295 stopped
* thread #1, name = 'ex', stop reason = breakpoint 1.1
frame #0: 0x00000000004004b0 ex`fun(b=<unavailable>) at ex.cpp:5:3
2 void ext(bool) {}
3 __attribute__((noinline))
4 void fun(bool b) {
-> 5 ext(b);
6 }
7 int main() {
8 fun(true);
(lldb) p b
error: Couldn't materialize: couldn't get the value of variable b: Unsupported type size in DW_OP_convert
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzlV0lv4zYU_jXyhbCh3fLBBydO2gFazGCawQC9CJREWWxoUiApJ5lf3_co25ITO07RYi4VtJJv49v4qVDVy7IUVG5I0XFhyRO3DVmkWcH8pMjqqgyqMCr9JCnLeJFGYeTTbMHqokwW6Zx4YRb6YTj1g2kQeuHC89eev3qgesOsF63Ic5bmaTzt5KNUT3IquOyepxvZ9XT9_dZpN2rLLN8yQ9iWW0PW3_OH1S95QQ3L7UvLyPrTnemtsw0j1FrNi84yJFw95MWLZbnhPxgxzBKriD8jDw03BE5VGKZ3tBCMPDVMEibhnYPO9ffV1_tdQrh0MmslhHrCCc1araquZHpGflPqEdQ5CrABqHSv8y7vpOEbyao8QEf4z747wggcAZp42aD2zrDqoEGoklquwITnVjNj8BXlealfwDWWEjOUQg1pqbZE1YSSUskd044JCMGGz1_yfswC7WzsUxC2P_vPMCagGdTOyrbtx_L86MM8B3lwqtZKJVHxMZQ7xStgAwVZoZRAm7z5jTdfXxQiFZfg3bdS6k7upZDiIMfNkoMCpI_2g0cVXFqypVw66SdcvUCrOzZmJBA922lJ_LeyTu7oE5d605JMP4dkuqmeqK6nyd5NZKrwTQ3kQuy2U0dUdduWWGbsYXoUfEh78iZ9D7adHn3uSrqF-YVbYPg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