[Bug c++/59354] Unexpected result in g++ when casting int to char from an stl vector to an array
gcc-bugzilla at contacts dot eelis.net
gcc-bugzilla@gcc.gnu.org
Thu Jan 1 13:54:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59354
Eelis <gcc-bugzilla at contacts dot eelis.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gcc-bugzilla at contacts dot eelis
| |.net
--- Comment #1 from Eelis <gcc-bugzilla at contacts dot eelis.net> ---
This is not specific to std::vector and not specific to C++.
C testcase:
#include <stdio.h>
#include <stdint.h>
int main()
{
uint32_t a[256] = {};
uint8_t b[1000] = {};
for(int i = 0; i != 256; ++i)
a[i] = i % 5;
for (int z = 0 ; z < 16; z++)
for (int y = 0 ; y < 4; y++)
for (int x = 0 ; x < 4; x++)
b[y * 64 + z*4 + x] = a[z * 16 + y * 4 + x];
printf("%d\n", b[4]);
return 0;
}
Prints '4' without -mno-sse, prints '1' with -mno-sse.
More information about the Gcc-bugs
mailing list