[LLVMbugs] [Bug 160] [llvmg++] Virtual function thunk produces illegal .s file

bugzilla-daemon at zion.cs.uiuc.edu bugzilla-daemon at zion.cs.uiuc.edu
Thu Nov 27 17:32:17 PST 2003


http://llvm.cs.uiuc.edu/bugs/show_bug.cgi?id=160

sabre at nondot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From sabre at nondot.org  2003-11-27 19:32 -------
Fixed.

Testcase here:
test/Regression/C++Frontend/2003-11-27-MultipleInheritanceThunk.cpp

Patched like so:

$ diff -u llvm-expand.c~ llvm-expand.c
--- llvm-expand.c~      2003-11-27 14:43:10.000000000 -0600
+++ llvm-expand.c       2003-11-27 19:26:36.000000000 -0600
@@ -60,6 +60,8 @@
 static void llvm_expand_decl_cleanup(llvm_function *Fn, tree decl,
                                      tree cleanup, int eh_only);
 
+extern int isPassedByInvisibleReference(tree Type);
+
 /*===----------------------------------------------------------------------===**
               ... Helper functions for Instruction Emission ...
  *===----------------------------------------------------------------------===*/
@@ -2759,8 +2761,17 @@
 
     if (!ArgTy) ArgTy = ActualArgTy;
 
-    /* If this argument is a structure passed by value... */
-    if (llvm_type_is_composite(ActualArgTy)) {
+    /* If this argument is passed by invisible reference... */
+    if (isPassedByInvisibleReference(TREE_TYPE(TREE_VALUE(arg)))) {
+      /* Get the address of the parameters passed in. */
+      llvm_value *ArgAddr = llvm_expand_lvalue_expr(Fn, TREE_VALUE(arg), 0, 0);
+      if (ArgTy) ArgVal = cast_if_type_not_equal(Fn, ArgVal, ArgTy);
+      Call->Operands[NumArgs+ArgOffset] = ArgVal;
+      CalledFuncType->Elements[1+NumArgs] = ArgVal->Ty;
+      ++NumArgs;
+ 
+      /* If this argument is a structure passed by value... */
+    } else if (llvm_type_is_composite(ActualArgTy)) {
       /* Get the address of the parameters passed in. */
       llvm_value *ArgAddr = llvm_expand_lvalue_expr(Fn, TREE_VALUE(arg), 0, 0);
       assert(ActualArgTy == GET_POINTER_TYPE_ELEMENT(ArgAddr->Ty));
@@ -6148,7 +6164,6 @@
      lvalues in the function, we copy these arguments into locally alloca'd
      values so that their address is exposed */
   {
-    extern int isPassedByInvisibleReference(tree Type);
     unsigned ArgNo = ReturnsComposite ? 1 : 0;
     for (; Args; Args = TREE_CHAIN(Args)) {
       llvm_instruction *A = 0;




------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list