[LLVMdev] r53212 broke LLVM on openbsd-4.3/gcc-3.3.5, patch.

Laurence Tratt laurie at tratt.net
Tue Jul 22 11:14:04 PDT 2008


On Thu, Jul 10, 2008 at 02:10:18PM +0530, Mahadevan R wrote:

I was just wondering if anyone had been able to look at Mahadevan's patch?
It makes LLVM compile again on OpenBSD with gcc 3, and doesn't seem to cause
any regressions. It would definitely make some of our lives easier if this
was in SVN rather than having to be applied manually each time :)

> The custom allocator-related changes committed in rev. 53212 broke LLVM
> build on openbsd-4.3 with gcc-3.3.5 (i386 and amd64). The attached patch
> fixes this.
>
> This looks like an issue with gcc-3.3.5, and I'm not sure if you guys will
> be wanting to support this compiler. Just sharing the patch hoping it helps
> someone.


Laurie
-- 
http://tratt.net/laurie/ -- Personal
http://convergepl.org/   -- The Converge programming language
-------------- next part --------------
Index: include/llvm/CodeGen/MachineFunction.h
===================================================================
--- include/llvm/CodeGen/MachineFunction.h	(revision 53390)
+++ include/llvm/CodeGen/MachineFunction.h	(working copy)
@@ -136,7 +136,11 @@
   ///
   template<typename Ty>
   Ty *getInfo() {
-    if (!MFInfo) MFInfo = new (Allocator.Allocate<Ty>()) Ty(*this);
+    if (!MFInfo) {
+        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-dev mailing list