From 219c7905c503ece263bb755479edc16430870e83 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 25 Jul 2008 00:36:05 +0000 Subject: [PATCH] Apply a patch from Mahadevan R, with minor formatting changes, to workaround a GCC 3.3 bug observed on OpenBSD. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54002 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineFunction.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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");