[clang] [clang][RISCV] Fix clang dwarf info generation for unprtototyped function (PR #150022)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 28 10:59:50 PDT 2025
efriedma-quic wrote:
So according to the standard, unprototyped function calls are not variadic: if you try to call a variadic function using an unprototyped function, the behavior is formally undefined. On some targets, for some function signatures, it might appear to work.
On x86 specifically, we have a minor compatibility hack: if you call an unprototyped function with certain arguments, we emit it as if it was variadic, so the backend knows to set "al". This makes calling a variadic function through an unprototyped signature work in some cases. But this is just a best-effort thing, to try to make broken code appear to work. And it isn't portable.
CGDebugInfo should probably be using something like `dyn_cast<Function>(CallOrInvoke->getCalledOperand()`, not `getCalledFunction()`, to avoid running into this.
https://github.com/llvm/llvm-project/pull/150022
More information about the cfe-commits
mailing list