[LLVMbugs] [Bug 22525] New: incorrect cast in LLVMAddAlias

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 9 13:45:46 PST 2015


http://llvm.org/bugs/show_bug.cgi?id=22525

            Bug ID: 22525
           Summary: incorrect cast in LLVMAddAlias
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Core LLVM classes
          Assignee: unassignedbugs at nondot.org
          Reporter: b.r.longbons at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The below patch (I think) fixes an assert failure in valid code due to r210062
being incomplete.

Relevant links:
http://llvm.org/bugs/show_bug.cgi?id=10367
http://llvm.org/viewvc/llvm-project?view=revision&revision=209007
http://llvm.org/viewvc/llvm-project?view=revision&revision=210062

Essentially, after all that, LLVM 3.5 ended up being the same as 3.4 was, but
this incorrect cast remained.

diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp
index acf63a3..3fa6622 100644
--- a/lib/IR/Core.cpp
+++ b/lib/IR/Core.cpp
@@ -1522,7 +1522,7 @@ LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef
Ty, LLVMValueRef Aliasee,
   auto *PTy = cast<PointerType>(unwrap(Ty));
   return wrap(GlobalAlias::create(PTy->getElementType(),
PTy->getAddressSpace(),
                                   GlobalValue::ExternalLinkage, Name,
-                                  unwrap<GlobalObject>(Aliasee), unwrap(M)));
+                                  unwrap<Constant>(Aliasee), unwrap(M)));
 }

 /*--.. Operations on functions
.............................................--*/

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150209/98cf2cbf/attachment.html>


More information about the llvm-bugs mailing list