public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/19410] Overlapping memcpy with big struct copies
Date: Mon, 12 Sep 2005 07:12:00 -0000	[thread overview]
Message-ID: <20050912071222.2791.qmail@sourceware.org> (raw)
In-Reply-To: <20050112225244.19410.baldrick@free.fr>


------- Additional Comments From ebotcazou at gcc dot gnu dot org  2005-09-12 07:12 -------
Here are 2 equivalent testcases in Ada and C:

procedure p is

  SUBTYPE INT IS INTEGER RANGE 0..1000;

  TYPE RECTYPE (CONSTRAINT : INT := 80) IS
  RECORD
    INTFIELD  : INTEGER;
    STRFIELD  : STRING (1..CONSTRAINT);
  END RECORD;

  REC1  : RECTYPE(1000);

  PROCEDURE COPY_RECTYPE (REC : OUT RECTYPE) is
  begin
    REC := REC1;
  end;

begin
  COPY_RECTYPE (REC1);
end;


struct A
{
  int a[1024];
};

struct A my_a;

void g(struct A *a)
{
  *a = my_a;
}

int main(void)
{
  g(&my_a);
}


The call to "memcpy" is hard-wired in the middle-end (expr.c:1390):

void
init_block_move_fn (const char *asmspec)
{
  if (!block_move_fn)
    {
      tree args, fn;

      fn = get_identifier ("memcpy");
      args = build_function_type_list (ptr_type_node, ptr_type_node,
				       const_ptr_type_node, sizetype,
				       NULL_TREE);

      fn = build_decl (FUNCTION_DECL, fn, args);
      DECL_EXTERNAL (fn) = 1;
      TREE_PUBLIC (fn) = 1;
      DECL_ARTIFICIAL (fn) = 1;
      TREE_NOTHROW (fn) = 1;

      block_move_fn = fn;
    }


I still don't plan to work on this in the near future.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org
         AssignedTo|ebotcazou at gcc dot gnu dot|unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


  parent reply	other threads:[~2005-09-12  7:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-12 22:52 [Bug ada/19410] New: ACATS c64106a - valgrind detects wrong code (overlapping memcpy) baldrick at free dot fr
2005-01-12 23:12 ` [Bug ada/19410] " baldrick at free dot fr
2005-01-12 23:36 ` [Bug middle-end/19410] Overlapping memcpy with big struct copies (ACATS c64106a) pinskia at gcc dot gnu dot org
2005-01-12 23:52 ` baldrick at free dot fr
2005-01-12 23:57 ` pinskia at gcc dot gnu dot org
2005-01-13  0:08 ` baldrick at free dot fr
2005-01-13  0:13 ` pinskia at gcc dot gnu dot org
2005-01-13 10:49 ` baldrick at free dot fr
2005-02-24 19:00 ` bosch at gcc dot gnu dot org
2005-02-24 21:23 ` ebotcazou at gcc dot gnu dot org
2005-09-12  7:12 ` ebotcazou at gcc dot gnu dot org [this message]
     [not found] <bug-19410-8622@http.gcc.gnu.org/bugzilla/>
2006-12-01  8:31 ` [Bug middle-end/19410] Overlapping memcpy with big struct copies baldrick at gcc dot gnu dot org

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=20050912071222.2791.qmail@sourceware.org \
    --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).