[clang] [clang][ARM] Fix warning for VFP function calls from interrupts. (PR #91870)
Chris Copeland via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 12 21:52:56 PDT 2024
chrisnc wrote:
Thank you for the review!
> * Calling a function marked interrupt from a function marked interrupt is still UB isn't it? Should there be another warning to cover that scenario as well?
Correct. I can create a separate issue to describe such a warning.
> * I see that gcc has a warning in `-Wattributes` for this, you should raise a bug there equivalent to the one llvm has, perhaps there even is one already.
It does, but `gcc`'s `-Wattributes` doesn't suffer from any of the issues being addressed here: it's already a separate flag, it cannot be silenced by putting `__attribute__((interrupt))` on the callee, and its warning text describes compiling with `-mgeneral-regs-only` to avoid the issue, though this only works when passed on the command line, not with `__attribute__((target("general-regs-only")))`.
It seems that LLVM does not have this target feature for 32-bit Arm, so I opted for `soft-float` as the escape hatch, which should achieve the same result, and check for it in function attributes. It is not checked transitively though, so this PR will not catch cases where an interrupt calls a soft-float function that then calls a function that uses VFP. The latter call is otherwise allowed though. IMO this is still a lot better than not having the escape hatch, but I'm open to suggestions.
https://github.com/llvm/llvm-project/pull/91870
More information about the cfe-commits
mailing list