This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug middle-end/19410] Overlapping memcpy with big struct copies


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


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