[LLVMbugs] [Bug 165] [llvmg++] call through array of pointers to member functions causes assertion

bugzilla-daemon at zion.cs.uiuc.edu bugzilla-daemon at zion.cs.uiuc.edu
Sun Dec 7 22:32:20 PST 2003


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

sabre at nondot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|[llvmg++] call through array|[llvmg++] call through array
                   |of pointers to member       |of pointers to member
                   |functions fails assertion   |functions causes assertion



------- Additional Comments From sabre at nondot.org  2003-12-08 00:32 -------
Fixed.

Testcase here: test/Regression/C++Frontend/2003-12-08-ArrayOfPtrToMemberFunc.cpp

Patch here:

$ diff -u llvm-expand.c~ llvm-expand.c
--- llvm-expand.c~      Fri Nov 28 22:21:26 2003
+++ llvm-expand.c       Mon Dec  8 00:27:54 2003
@@ -5044,6 +5044,37 @@
     llvm_expand_expr(Fn, exp, Result);
     break;
 
+  case SAVE_EXPR:
+    /* Return the innermost context enclosing DECL that is a FUNCTION_DECL, or
+       zero if none.  */
+    context = decl_function_context (exp);
+
+    /* If this SAVE_EXPR was at global context, assume we are an
+       initialization function and move it into our context.  */
+    if (context == 0)
+      SAVE_EXPR_CONTEXT (exp) = current_function_decl;
+
+    /* We treat inline_function_decl as an alias for the current function
+       because that is the inline function whose vars, types, etc.
+       are being merged into the current function.
+       See expand_inline_function.  */
+    if (context == current_function_decl)
+      context = 0;
+
+    /* If this is non-local, handle it.  */
+    if (context) LLVM_TODO_TREE(exp);  /* Don't handle nested functions yet! */
+
+    /* If the expression has not been computed yet... */
+    if (SAVE_EXPR_LLVM(exp) == 0) {
+      /* Expand the saved expression. This does not handle bit-fields yet. */
+      Result = llvm_expand_lvalue_expr(Fn, TREE_OPERAND(exp, 0), 0, 0);
+      SAVE_EXPR_LLVM(exp) = Result;
+      TREE_USED(exp) = 1;
+    } else {
+      Result = SAVE_EXPR_LLVM(exp);
+    }
+    break;
+
   case COND_EXPR: {      /* ?: expression */
     /* Allocate a new temporary to hold the result of the expression */
     llvm_basicblock *TrueBlock = llvm_basicblock_new("cond_true");

Thanks for the bug report!

-Chris



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