This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/28361] New: Pointer arithmetic failure
- From: "pfister at reith-pfister dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jul 2006 16:48:01 -0000
- Subject: [Bug c++/28361] New: Pointer arithmetic failure
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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