This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: An optimization bug in egcs 1.0.2?
- To: hjl at lucon dot org (H.J. Lu)
- Subject: Re: An optimization bug in egcs 1.0.2?
- From: John Carr <jfc at mit dot edu>
- Date: Mon, 23 Mar 1998 19:43:55 -0500
- cc: egcs at cygnus dot com
The code calls memcpy with overlapping objects. That is undefined in
ANSI C; use memmove instead. (It also subtracts pointers to void so
the authors presumably didn't care about ANSI C, but the misuse of
memcpy is a real problem.)
There may also be a bug in egcs in addition to the bug in the code.
Can you generate a standalone test case with annotated assembly code?
> if (imap->l_global)
> {
> /* This object is in the global scope list. Remove it. */
> struct link_map **tail = _dl_global_scope_end;
> do
> --tail;
> while (*tail != imap);
> --_dl_global_scope_end;
> memcpy (tail, tail + 1,
> (void *) _dl_global_scope_end - (void *) tail);
> _dl_global_scope_end[0] = NULL;
> _dl_global_scope_end[1] = NULL;
> }