public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: hjl@lucon.org (H.J. Lu)
To: jfc@mit.edu (John Carr)
Cc: egcs@cygnus.com, drepper@cygnus.com (Ulrich Drepper)
Subject: Re: An optimization bug in egcs 1.0.2?
Date: Mon, 23 Mar 1998 19:24:00 -0000	[thread overview]
Message-ID: <m0yHHxm-00058JC@ocean.lucon.org> (raw)
In-Reply-To: <199803240043.TAA18518@jfc.>

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

It is from the dynamic linker in glibc 2. memcpy is safe there.
memcpy is used for optimization.

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

I don't think there is a question on egcs. I don't want to spend
any more time on it since it has been fixed in glibc 2. If you really
want to look into it, I can do it when I find time.

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


-- 
H.J. Lu (hjl@gnu.org)

  reply	other threads:[~1998-03-23 19:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-03-23 15:11 H.J. Lu
1998-03-23 19:24 ` John Carr
1998-03-23 19:24   ` H.J. Lu [this message]
1998-03-23 23:47     ` Jeffrey A Law
1998-03-24 11:16     ` Richard Henderson
1998-03-24  8:29       ` H.J. Lu
1998-03-24  9:27       ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m0yHHxm-00058JC@ocean.lucon.org \
    --to=hjl@lucon.org \
    --cc=drepper@cygnus.com \
    --cc=egcs@cygnus.com \
    --cc=jfc@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).