------- 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