AaronBallman wrote:

> If attribute is dropped, then yes. E.g. if function is called through `ptr2` 
> from the example above, the register allocator would assume that all caller 
> saved registers are clobbered. However, the generated code is still correct, 
> nothing will break or behave unexpectedly. Worst case, some performance would 
> be left on a table. That's why I'm inclined to say that this is not an error.

But a mismatch can still potentially result in a miscompilation, right? e.g., 
you have a function in a header file with the `bfp_fastcall` attribute on it. 
The definition of the function is compiled into a library with Clang 16 and 
ignores the unknown attribute, so the callee will clobber registers. But the 
declaration is used by an application compiled with Clang 20 and assumes the 
attribute means the callee won't clobber registers, so doesn't generate the 
save/restore code. When the call resolves, the registers are clobbered 
unexpectedly, right? But if the attribute was part of the function type, this 
program presumably would not link due to type mismatch.

https://github.com/llvm/llvm-project/pull/101228
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to