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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to