This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/40757] gcc 4.4.0 miscompiles mpfr-2.4.1
- From: "david dot kirkby at onetel dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Jul 2009 01:14:09 -0000
- Subject: [Bug c/40757] gcc 4.4.0 miscompiles mpfr-2.4.1
- References: <bug-40757-16207@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #20 from david dot kirkby at onetel dot net 2009-07-18 01:14 -------
(In reply to comment #19)
> (In reply to comment #18)
> > I've compiled and linked that code. It does not abort.
>
> Bad point for this theory :-(
> The result could still depend on the alignment of the pointer, so you could try
> replacing buf[0] by buf[4] and calling memset(buf+4,...) (try several small
> values instead of 4).
>
I tried this in a loop. It still works, with no abort.
typedef __SIZE_TYPE__ size_t;
extern void *memset (void *, const void *, size_t);
extern void abort (void);
volatile size_t i = 0x80000000U, j = 0x80000000U;
char buf[16];
int main (void)
{
int n;
for (n=0 ; n <=64;++n) {
if (sizeof (size_t) != 4)
return 0;
buf[n] = 6;
memset (buf+n, 0, i + j);
if (buf[0] != 6)
abort ();
}
return 0;
}
I extended 'n' to larger values and find it does abort when it is 5592, but not
exactly the 'small' value you were looking for.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40757