<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - bblockaddress does not work correctly with program address spaces"
   href="https://bugs.llvm.org/show_bug.cgi?id=44501">44501</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>bblockaddress does not work correctly with program address spaces
          </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>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </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>Matthew.Arsenault@amd.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>arichardson.kde@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This program should fail the verifier, as the blockaddress pointer type does
not match the function's address space.

target datalayout = "e-p:64:64-p1:32:32-P1"

define i32 @label_size(i64 %idx) addrspace(1) {
entry:
  %int = ptrtoint i8* blockaddress(@label_size, %bb) to i32
  br label %bb

bb:
  ret i32 %int
}

If you do use the correct pointer type, the parser fails on it:
define i32 @label_size(i64 %idx) addrspace(1) {
entry:
  %int = ptrtoint i8 addrspace(1)* blockaddress(@label_size, %bb) to i32
  br label %bb

bb:
  ret i32 %int
}

gives "error: constant expression type mismatch"

Additionally, DataLayout::getTypeSizeInBits does not account for the program
address space when checking for the size of labels.</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>