[Bug c/88662] New: Document trap representations of _Bool
gonzalobg88 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jan 2 13:51:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88662
Bug ID: 88662
Summary: Document trap representations of _Bool
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: gonzalobg88 at gmail dot com
Target Milestone: ---
Compiling
unsigned int foo(unsigned int x, _Bool b) {
return x - (unsigned int)b;
}
only produces correct results if the value of `_Bool` is either `0` or `1` [0],
see https://gcc.godbolt.org/z/l0DPjc:
foo:
movzx esi, sil
mov eax, edi
sub eax, esi
ret
This probably means that all other representations of `_Bool` are trap
representations, but this does not appear to be documented anywhere.
>From my reading of the C standard, the role that padding bits play for `_Bool`
is unclear.
[0] one can construct such a _Bool by writing to it via a char* .
More information about the Gcc-bugs
mailing list