[llvm-bugs] [Bug 49921] New: llvm::appendToGlobalArray() uses an unqualified function pointer, even on platforms where it doesn't make sense

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 11 03:42:55 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49921

            Bug ID: 49921
           Summary: llvm::appendToGlobalArray() uses an unqualified
                    function pointer, even on platforms where it doesn't
                    make sense
           Product: new-bugs
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ali.mpfard at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

`llvm::appendToGlobalArray` (and as a result, `appendToGlobalCtors` and
`appendToGlobalDtors`)
always produce an unqualified function pointer
(c.f.
https://github.com/llvm-project/llvm/blob/master/lib/Transforms/Utils/ModuleUtils.cpp#L31
),
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. https://github.com/llvm-project/llvm/blob/master/lib/IR/Verifier.cpp#L651
- 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.

-- 
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/20210411/bd813c2a/attachment.html>


More information about the llvm-bugs mailing list