This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: An optimization bug in egcs 1.0.2?



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]