[llvm-commits] [llvm] r54002 - /llvm/trunk/include/llvm/CodeGen/MachineFunction.h

Dan Gohman gohman at apple.com
Thu Jul 24 17:36:05 PDT 2008


Author: djg
Date: Thu Jul 24 19:36:05 2008
New Revision: 54002

URL: http://llvm.org/viewvc/llvm-project?rev=54002&view=rev
Log:
Apply a patch from Mahadevan R, with minor formatting changes, to
workaround a GCC 3.3 bug observed on OpenBSD.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineFunction.h

Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=54002&r1=54001&r2=54002&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Thu Jul 24 19:36:05 2008
@@ -136,7 +136,13 @@
   ///
   template<typename Ty>
   Ty *getInfo() {
-    if (!MFInfo) MFInfo = new (Allocator.Allocate<Ty>()) Ty(*this);
+    if (!MFInfo) {
+        // This should be just `new (Allocator.Allocate<Ty>()) Ty(*this)', but
+        // that apparently breaks GCC 3.3.
+        Ty *Loc = static_cast<Ty*>(Allocator.Allocate(sizeof(Ty),
+                                                      AlignOf<Ty>::Alignment));
+        MFInfo = new (Loc) Ty(*this);
+    }
 
     assert((void*)dynamic_cast<Ty*>(MFInfo) == (void*)MFInfo &&
            "Invalid concrete type or multiple inheritence for getInfo");





More information about the llvm-commits mailing list