gimplify.c (gimplify_modify_expr_rhs): Use types_compatible_p.
authorMark Mitchell <mark@codesourcery.com>
Thu, 23 Dec 2004 21:55:12 +0000 (21:55 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 23 Dec 2004 21:55:12 +0000 (21:55 +0000)
* gimplify.c (gimplify_modify_expr_rhs): Use types_compatible_p.

* g++.dg/opt/temp1.C: Make memcpy actually copy bytes.

From-SVN: r92571

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/temp1.C

index 9f8e174b30da5ffea76188be56f8484872840a55..c84ae79e5860d783f664198ba4a6db6d1099dc30 100644 (file)
@@ -1,3 +1,7 @@
+2004-12-23  Mark Mitchell  <mark@codesourcery.com>
+
+       * gimplify.c (gimplify_modify_expr_rhs): Use types_compatible_p.
+
 2004-12-23  DJ Delorie  <dj@redhat.com>
 
        * genrecog.c (did_you_mean_codes): New.
index 0f610e4d24242542f575533737a3ff66084665dc..9bf4c4ec6a9809653ed0e7973a9fc407d70a4d91 100644 (file)
@@ -2817,8 +2817,9 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, tree *pre_p,
          pointer = TREE_OPERAND (*from_p, 0);
          STRIP_NOPS (pointer);
          if (TREE_CODE (pointer) == ADDR_EXPR
-             && (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (pointer, 0)))
-                 == TYPE_MAIN_VARIANT (TREE_TYPE (*from_p))))
+             && (lang_hooks.types_compatible_p 
+                 (TREE_TYPE (TREE_OPERAND (pointer, 0)),
+                  TREE_TYPE (*from_p))))
            {
              *from_p = TREE_OPERAND (pointer, 0); 
              ret = GS_OK;
index 518cf3dea6aaa18a211eca1df9c5f9aebd4a4218..e3e6ae7033cbcd98dba854ceda91e022df3f0f3c 100644 (file)
@@ -1,3 +1,7 @@
+2004-12-23  Mark Mitchell  <mark@codesourcery.com>
+
+       * g++.dg/opt/temp1.C: Make memcpy actually copy bytes.
+
 2004-12-23  Alexandre Oliva  <aoliva@redhat.com>
 
        * gcc.dg/empty2.c: Add missing dg-warning.
index 6454cdb50356732e253bc953b947e59f68005334..05dd2697171ae7e746c74f6e394ce9a03ae38488 100644 (file)
@@ -15,6 +15,10 @@ int i;
 extern "C"
 void *memcpy (void *dest, const void *src, __SIZE_TYPE__ n)
 {
+  char *d = (char *) dest;
+  const char *s = (const char *) src;
+  while (n--)
+    d[n] = s[n];
   ++i;
 }