<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 - Write new AVRFunctionAddressSpaceVerifier pass"
   href="https://bugs.llvm.org/show_bug.cgi?id=39573">39573</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Write new AVRFunctionAddressSpaceVerifier pass
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: AVR
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>me@dylanmckay.io
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>LLVM has recently gained support for specifying the program memory address
space in the data layout.

This address space will be the one that new functions will be placed into by
default.

There are still a few callsites in LLVM that assume that the default function
address space is the default address space zero. When AVR programs hits these
paths, the IR generated has a mix of addrspace(0) and addrspace(1) functions.

The AVR backend always puts code into program memory; that's just how the AVR
ELF format works. Problems arise when IR passes transform functions without
preserving their original address space, or create new functions
unconditionally in addrspace(0). Usually, the IR verifier will catch it, but
not always.

We should write an AVR-specific pass that verifies that every single function
in the module, and produces a hard error if there is a single function that is
not in addrspace(1). The error message should include the name of the function.

This will make it much less likely for new or existing LLVM address space
assumption bugs to go unnoticed.

An example of one of these bugs: <a href="https://github.com/avr-rust/rust/issues/117">https://github.com/avr-rust/rust/issues/117</a></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>