<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 - llvm::appendToGlobalArray() uses an unqualified function pointer, even on platforms where it doesn't make sense"
   href="https://bugs.llvm.org/show_bug.cgi?id=49921">49921</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm::appendToGlobalArray() uses an unqualified function pointer, even on platforms where it doesn't make sense
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ali.mpfard@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>`llvm::appendToGlobalArray` (and as a result, `appendToGlobalCtors` and
`appendToGlobalDtors`)
always produce an unqualified function pointer
(c.f.
<a href="https://github.com/llvm-project/llvm/blob/master/lib/Transforms/Utils/ModuleUtils.cpp#L31">https://github.com/llvm-project/llvm/blob/master/lib/Transforms/Utils/ModuleUtils.cpp#L31</a>
),
which later leads to the verifier rejecting the generated call with "wrong type
for intrinsic global variable"
for platforms that require a separate address space for functions (e.g. AVR)
(c.f. <a href="https://github.com/llvm-project/llvm/blob/master/lib/IR/Verifier.cpp#L651">https://github.com/llvm-project/llvm/blob/master/lib/IR/Verifier.cpp#L651</a>
- checking against a function pointer in the default program address space).


I'm not sure what the process for proposing fixes in llvm is, so I decided to
submit a bug
instead of attempting to make a merge request with a fix.</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>