diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index 2fbe9b803ee..98f3a948394 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -136,7 +136,13 @@ public: /// template Ty *getInfo() { - if (!MFInfo) MFInfo = new (Allocator.Allocate()) Ty(*this); + if (!MFInfo) { + // This should be just `new (Allocator.Allocate()) Ty(*this)', but + // that apparently breaks GCC 3.3. + Ty *Loc = static_cast(Allocator.Allocate(sizeof(Ty), + AlignOf::Alignment)); + MFInfo = new (Loc) Ty(*this); + } assert((void*)dynamic_cast(MFInfo) == (void*)MFInfo && "Invalid concrete type or multiple inheritence for getInfo");