https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129011
Zhiyang Chen <jeffchen006 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jeffchen006 at gmail dot com
--- Comment #4 from Zhiyang Chen <jeffchen006 at gmail dot com> ---
The same (view_convert (convert @1)) strip also hits plain C without _BitInt.
Wrong at -Os and -O2 in every release we have: 7.5 to 15.2 print 255, 16.2 and
trunk print 0; the right answer is 1.
int printf(const char *, ...);
struct S { int b : 1; } s = { -1 };
int main(void) {
_Bool x = s.b;
unsigned char c = *(unsigned char *)&x;
printf("%d\n", c);
return 0;
}
$ gcc -O1 t.c && ./a.out
1
$ gcc -Os t.c && ./a.out
0
Clean with -fsanitize=address,undefined (gcc and clang).