if you do something like this: char *buffer; int i;
buffer = (char *) malloc (sizeof (struct something) * 1024); for (i=0; i < 1024;i++) memcpy (buffer + i * sizeof (struct something),&i;sizeof (int)); then when i == 255 there is no data stored in buffer. I mean i can read out the correct value from buffer for every increment (i * sizeof (struct something)), but when i == 255 the value read out is 0. When i == 256 all works fine again. -- Summary: Pointer arithmetic failure Product: gcc Version: 4.0.3 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pfister at reith-pfister dot de GCC build triplet: x86 GCC host triplet: x86 GCC target triplet: x86 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28361