First Last Prev Next    No search results available
Details
: [llvmg++] Cannot use pointer to member to initialize global
Bug#: 128
: tools
: llvm-g++
Status: RESOLVED
Resolution: FIXED
: All
: All
: 1.0
: P2
: normal
: 1.1

:
: compile-fail
:
:
  Show dependency tree - Show dependency graph
People
Reporter: Chris Lattner <sabre@nondot.org>
Assigned To: Chris Lattner <sabre@nondot.org>

Attachments


Note

You need to log in before you can comment on or make changes to this bug.

Related actions


Description:   Opened: 2003-11-18 14:10
This testcase:

struct Gfx {
  void opMoveSetShowText();
};

struct Operator {
  void (Gfx::*func)();
};

Operator opTab[] = {
  {&Gfx::opMoveSetShowText},
};


Inspires this lovely evocation from llvmg++:

$ llvmg++ tmp2.cc -c
ERROR: In function llvm_expand_constant_expr:4471, tree not handled by LLVM yet!
 <ptrmem_cst 0x40262280
    type <record_type 0x40261310 DI
        size <integer_cst 0x4001b618 constant 64>
        unit size <integer_cst 0x4001b99c constant 8>
        align 32 symtab 0 alias set -1
        fields <field_decl 0x40261460 __pfn type <pointer_type 0x402612a0>
            unsigned SI file tmp2.cc line 6
            size <integer_cst 0x4001b9b0 constant 32>
            unit size <integer_cst 0x4001b9d8 constant 4>
            align 32 offset_align 32
            offset <integer_cst 0x4001ba64 constant 0>
            bit offset <integer_cst 0x4001bb04 constant 0> context <record_type
0x40261310> arguments <integer_cst 0x4001ba64 0> chain <field_decl 0x402614d0
__delta>>
        ptrmemfunc fn type <pointer_type 0x402612a0 type <method_type 0x4025df50>
            unsigned SI size <integer_cst 0x4001b9b0 32> unit size <integer_cst
0x4001b9d8 4>
            align 32 symtab 0 alias set -1>
        pointer_to_this <pointer_type 0x402613f0> chain <type_decl 0x40261540
__ptrmemfunc_type>>
    constant>
tmp2.cc:11: internal compiler error: in llvm_expand_constant_expr, at
llvm-expand.c:4471
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://llvm.cs.uiuc.edu> for instructions.
------- Comment #1 From Chris Lattner 2003-11-18 14:28:18 -------
Fixed.

Testcase here:
test/Regression/C++Frontend/2003-11-18-PtrMemConstantInitializer.cpp

Patched like so:

$ diff -u llvm-expand.c~ llvm-expand.c
--- llvm-expand.c~      2003-11-18 00:23:07.000000000 -0600
+++ llvm-expand.c       2003-11-18 14:22:13.000000000 -0600
@@ -4302,6 +4302,11 @@
   llvm_type *Ty = llvm_type_get_from_tree(TREE_TYPE(exp));
   llvm_value *Val = 0;
 
+  /* If this is a front-end specific constant, like a PTRMEM_CST, expand it to
+   * primitives first.
+   */
+  exp = lang_hooks.expand_constant(exp);
+
   switch (TREE_CODE(exp)) {
   case INTEGER_CST: {  /* Integer constant */
     HOST_WIDE_INT HI = (unsigned HOST_WIDE_INT)TREE_INT_CST_HIGH(exp);

-Chris

First Last Prev Next    No search results available