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

--- Comment #4 from d25fe0be@ <d25fe0be at outlook dot com> ---
Per n4659 7.8/[conv.integral]:

```
If the destination type is signed, the value is unchanged if it can be
represented in the destination type;
otherwise, the value is implementation-defined.
```

Isn't `(char)xxx` implementation-defined? (as GCC treats `char` as signed)

And as the following code prints 0, I believe that GCC defines the result of
such casting as 0:

```
#include <stdio.h>
int xxx = 0x01000000;
int main() {
    printf("%d\n", (char)xxx);
    return 0;
}
```

So I think the output should indeed be 0.

Reply via email to