https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88662

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |documentation

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to gnzlbg from comment #0)
> 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`

Because (unsigned int)b is undefined otherwise.

> [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. 

The representation of _Bool is unspecified, not implementation-defined, so
doesn't need to be documented.

Reply via email to