public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "brooks at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/56888] memcpy implementation optimized as a call to memcpy
Date: Wed, 17 Jul 2013 17:10:00 -0000	[thread overview]
Message-ID: <bug-56888-4-5IbFXjfe8V@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56888-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888

--- Comment #12 from Brooks Moses <brooks at gcc dot gnu.org> ---
(In reply to Paulo J. Matos from comment #11)
> A non-bug? If you write a memcpy function by hand and call it memcpy, gcc
> replaces the function body by a call to memcpy which generates an infinite
> loop. How come it's a non-bug?

Because if you do that you're invoking undefined behavior.  There's already a
memcpy function in the standard library, so naming your own function memcpy
violates the one-definition-per-function rule.  Even if it "worked", naming
your own function memcpy would likely break other standard library functions
that call the "real" memcpy.

Now, if this replacement still happens when you compile with -nostdlib, that
would be a bug since it becomes legal code in that case.  But that's somewhat
of a separate issue and should be filed separately if it happens.  (We should
arguably also have a test for it, if we don't already.)


  parent reply	other threads:[~2013-07-17 17:10 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08 23:40 [Bug middle-end/56888] New: " xanclic at gmail dot com
2013-04-09  9:59 ` [Bug middle-end/56888] " mikpe at it dot uu.se
2013-04-09 10:01 ` rguenth at gcc dot gnu.org
2013-04-09 10:01 ` jakub at gcc dot gnu.org
2013-04-09 13:02 ` xanclic at gmail dot com
2013-04-09 13:17 ` rguenther at suse dot de
2013-04-09 13:20 ` xanclic at gmail dot com
2013-04-11 11:29 ` rguenth at gcc dot gnu.org
2013-06-23  0:01 ` jeff@deseret-tech.com
2013-07-17  7:52 ` paulo@matos-sorge.com
2013-07-17 17:10 ` brooks at gcc dot gnu.org [this message]
2013-07-17 17:28 ` xanclic at gmail dot com
2013-07-17 20:36 ` schwab@linux-m68k.org
2013-07-17 20:59 ` xanclic at gmail dot com
2013-07-17 22:31 ` schwab@linux-m68k.org
2013-07-18  0:26 ` xanclic at gmail dot com
2013-07-18 10:35 ` paulo@matos-sorge.com
2013-07-28  3:30 ` bugdal at aerifal dot cx
2013-10-02  7:59 ` bernd.edlinger at hotmail dot de
2013-10-02  8:17 ` rguenth at gcc dot gnu.org
2013-10-02  8:49 ` bernd.edlinger at hotmail dot de
2013-10-02  8:59 ` rguenther at suse dot de
2014-02-17  3:48 ` janosch.rux at web dot de
2014-04-29 13:50 ` rguenth at gcc dot gnu.org
2014-04-29 13:57 ` rguenth at gcc dot gnu.org
2014-04-29 14:47 ` bugdal at aerifal dot cx
2014-05-06 10:51 ` rguenth at gcc dot gnu.org
2014-05-06 10:52 ` rguenth at gcc dot gnu.org
2014-06-06 10:40 ` terra at gnome dot org
2014-06-06 11:54 ` rguenther at suse dot de
2014-11-03  7:09 ` fd935653 at opayq dot com
2020-08-16 22:51 ` pinskia at gcc dot gnu.org
2022-06-03  6:55 ` pinskia at gcc dot gnu.org
2022-10-26 17:06 ` pinskia at gcc dot gnu.org
2023-12-18 20:59 ` terra at gnome dot org
2023-12-18 21:32 ` david at westcontrol dot com
2023-12-19  2:07 ` terra at gnome dot org
2023-12-19  8:03 ` rguenth at gcc dot gnu.org
2023-12-19  8:06 ` rguenth at gcc dot gnu.org
2023-12-19  8:28 ` david at westcontrol dot com

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=bug-56888-4-5IbFXjfe8V@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).