On 2016-06-08 10:29, Richard Biener wrote:
On Wed, Jun 8, 2016 at 8:36 AM, Alexander Cherepanov
<ch3r...@openwall.com> wrote:
[skip]
But my question is about the following example:
----------------------------------------------------------------------
#include <stdio.h>
int main()
{
_Bool b;
*(char *)&b = 123;
printf("%d\n", *(char *)&b);
}
----------------------------------------------------------------------
Results:
----------------------------------------------------------------------
$ gcc -std=c11 -pedantic -Wall -Wextra test.c && ./a.out
123
$ gcc -std=c11 -pedantic -Wall -Wextra -O3 test.c && ./a.out
1
----------------------------------------------------------------------
[skip]
Another explanation is that this is a bug. It manifests itself at the time
we re-write 'b' into SSA form, disregarding the fact that we access it
via a type that while matching in size does not match in precision.
Oh, that's much more boring outcome:-)
Can you open a bugreport?
Sure, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71452 .
--
Alexander Cherepanov