<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - incorrect cast in LLVMAddAlias"
   href="http://llvm.org/bugs/show_bug.cgi?id=22525">22525</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>incorrect cast in LLVMAddAlias
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Core LLVM classes
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>b.r.longbons@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The below patch (I think) fixes an assert failure in valid code due to r210062
being incomplete.

Relevant links:
<a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Fix the design of GlobalAlias to not require dest type to match source type"
   href="show_bug.cgi?id=10367">http://llvm.org/bugs/show_bug.cgi?id=10367</a>
<a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=209007">http://llvm.org/viewvc/llvm-project?view=revision&revision=209007</a>
<a href="http://llvm.org/viewvc/llvm-project?view=revision&revision=210062">http://llvm.org/viewvc/llvm-project?view=revision&revision=210062</a>

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
.............................................--*/</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>