https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63814

            Bug ID: 63814
           Summary: g++.dg/ipa/pr61160-1.C fails with -m32 on darwin14
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxcoudert at gcc dot gnu.org

With -O3 -m32, g++.dg/ipa/pr61160-1.C fails on x86_64-apple-darwin14. This is a
very slightly reduced testcase:

---------------------------------
struct CBase {
  virtual void BaseFunc () {}
};

struct MMixin {
  virtual void * MixinFunc (int, int) = 0;
};

struct CExample: CBase, public MMixin
{
  void *MixinFunc (int arg, int arg2)
  {
    return this;
  }
};

void *test (MMixin & anExample)
{
  return anExample.MixinFunc (0, 0);
}

int main ()
{
  CExample c;
  return (test (c) != 0);
}
---------------------------------


The failure is:

$ ./bin/g++ pr61160-1.C -m32 -O3                
pr61160-1.C:26:1: error: edge points to wrong declaration:
 }
 ^
 <function_decl 0x142795e58 MixinFunc.constprop
    type <method_type 0x142799930
        type <pointer_type 0x1426272a0 type <void_type 0x142627150 void>
            public unsigned SI
            size <integer_cst 0x142601e70 constant 32>
            unit size <integer_cst 0x142601e88 constant 4>
            align 32 symtab 0 alias set 1 canonical type 0x1426272a0
            pointer_to_this <pointer_type 0x14262ec78>>
        QI
        size <integer_cst 0x142601fa8 constant 8>
        unit size <integer_cst 0x142601fc0 constant 1>
        align 8 symtab 0 alias set -1 canonical type 0x142799930 method
basetype <record_type 0x14277db28 CExample>
        arg-types <tree_list 0x1427a4370 value <pointer_type 0x14277ddc8>
            chain <tree_list 0x142617bb8 value <void_type 0x142627150 void>>>>
    readonly addressable used nothrow static autoinline decl_5 QI defer-output
file pr61160-1.C line 11 col 9 align 16 context <record_type 0x14277db28
CExample>>
 Instead of: <function_decl 0x14276ea20 _ZThn4_N8CExample9MixinFuncEii
    type <method_type 0x14277dd20
        type <pointer_type 0x1426272a0 type <void_type 0x142627150 void>
            public unsigned SI
            size <integer_cst 0x142601e70 constant 32>
            unit size <integer_cst 0x142601e88 constant 4>
            align 32 symtab 0 alias set 1 canonical type 0x1426272a0
            pointer_to_this <pointer_type 0x14262ec78>>
        QI
        size <integer_cst 0x142601fa8 constant 8>
        unit size <integer_cst 0x142601fc0 constant 1>
        align 8 symtab 0 alias set -1 canonical type 0x14277dd20 method
basetype <record_type 0x14277db28 CExample>
        arg-types <tree_list 0x14277c640 value <pointer_type 0x14277ddc8>
            chain <tree_list 0x14277c320 value <integer_type 0x142605690 int>
                chain <tree_list 0x14277c348 value <integer_type 0x142605690
int>
                    chain <tree_list 0x142617bb8 value <void_type 0x142627150
void>>>>>
        pointer_to_this <pointer_type 0x14277f3f0>>
    readonly addressable asm_written used public weak virtual decl_5 QI file
pr61160-1.C line 11 col 9 align 8 context <record_type 0x14277db28 CExample>
    full-name "virtual void* CExample::_ZThn4_N8CExample9MixinFuncEii(int,
int)"
   >
main/13 (int main()) @0x14278d188
  Type: function definition analyzed
  Visibility: externally_visible public
  References: 
  Referring: 
  Availability: available
  First run: 0
  Function flags: body only_called_at_startup
  Called by: 
  Calls: _ZN8CExample9MixinFuncEii.constprop.3/35 (1.00 per call) (can throw
external) 
pr61160-1.C:26:1: internal compiler error: verify_cgraph_node failed

pr61160-1.C:26:1: internal compiler error: Abort trap: 6
g++: internal compiler error: Abort trap: 6 (program cc1plus)
zsh: abort      ./bin/g++ pr61160-1.C -m32 -O3


and the backtrace is:

  * frame #0: 0x0000000100ee03f0 cc1plus`internal_error(char const*, ...)
    frame #1: 0x000000010069adb7 cc1plus`cgraph_node::verify_node() + 4935
    frame #2: 0x000000010068fb48 cc1plus`symtab_node::verify() + 104
    frame #3: 0x00000001006904a8 cc1plus`symtab_node::verify_symtab_nodes() +
152
    frame #4: 0x000000010097ebfc
cc1plus`symbol_table::remove_unreachable_nodes(bool, __sFILE*) + 7148
    frame #5: 0x0000000100a5f60c cc1plus`execute_todo(unsigned int) + 348
    frame #6: 0x0000000100a61e2f cc1plus`execute_one_pass(opt_pass*) + 495
    frame #7: 0x0000000100a62aaa cc1plus`execute_ipa_pass_list(opt_pass*) + 154
    frame #8: 0x00000001006a18e9 cc1plus`symbol_table::compile() + 1385
    frame #9: 0x00000001006a375e
cc1plus`symbol_table::finalize_compilation_unit() + 110
    frame #10: 0x00000001001062e0 cc1plus`cp_write_global_declarations() + 4480
    frame #11: 0x0000000100b3cebf cc1plus`compile_file() + 143
    frame #12: 0x0000000100ff1ae4 cc1plus`toplev::main(int, char**) + 3764
    frame #13: 0x0000000100ff210c cc1plus`main + 44

Reply via email to