[llvm-commits] CVS: gcc-3.4/gcc/llvm-expand.c

Chris Lattner lattner at cs.uiuc.edu
Tue Feb 3 02:00:01 PST 2004


Changes in directory gcc-3.4/gcc:

llvm-expand.c updated: 1.5 -> 1.6

---
Log message:

Fix PR221: [llvm-gcc] miscompilation of 'X = Y = Z' with aggregate values
testcase: test/Programs/SingleSource/Regression/C/2004-02-03-AggregateCopy.c



---
Diffs of the changes:  (+10 -2)

Index: gcc-3.4/gcc/llvm-expand.c
diff -u gcc-3.4/gcc/llvm-expand.c:1.5 gcc-3.4/gcc/llvm-expand.c:1.6
--- gcc-3.4/gcc/llvm-expand.c:1.5	Mon Feb  2 11:42:13 2004
+++ gcc-3.4/gcc/llvm-expand.c	Tue Feb  3 01:59:32 2004
@@ -5933,8 +5933,16 @@
   case MODIFY_EXPR:      /* = expression */
     /* Expand the assignment out.  The result of a modify expr is the value
        produced, not the lvalue returned by llvm_expand_assignment.  */
-    llvm_expand_assignment(Fn, TREE_OPERAND (exp, 0),
-                           TREE_OPERAND (exp, 1), &Result);
+    op0 = llvm_expand_assignment(Fn, TREE_OPERAND (exp, 0),
+                                 TREE_OPERAND (exp, 1), &Result);
+
+    /* If this modify expression is being assigned to another location, make
+     * sure to expand the memberwise copy as well!
+     */
+    if (DestLoc)
+      llvm_copy_aggregate(Fn, DestLoc, op0,
+                          TYPE_VOLATILE(TREE_TYPE(TREE_OPERAND (exp, 0))), 0);
+
     break;
 
   case PREINCREMENT_EXPR:  return llvm_expand_increment(Fn, exp, 1, 1);





More information about the llvm-commits mailing list