[llvm] [DWARF] Emit 0/1 for constant boolean values (PR #151225)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 6 11:19:21 PDT 2025
dwblaikie wrote:
> > This leads to the debugger printing 255 instead of "true" for boolean variables.
>
> Do you have an example/Github issue of this? Shouldn't the debugger know how to present booleans in a particular language, regardless of which non-zero value was used to indicate truthness?
Arguable - it's UB to have a bool that isn't 0 or 1 (`-fsanitize=bool` catches this, for instance - there's some neat term for these sort of "corrupted" bools, but I forget what it is) so I'd expect a debugger to show the actual value and say something about the value being invalid. This'd help the developer understand why boolean tests (`if (x)` or `if (!x)`) don't work necessarily work as expected.
So, yeah, I think it is important we describe the value as 0 or 1 if it is 0 or 1, conceptually, at least.
https://github.com/llvm/llvm-project/pull/151225
More information about the llvm-commits
mailing list