You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[clang][ARM] Fix warning for VFP function calls from interrupts.
This warning has two issues:
- The interrupt attribute doesn't only change how volatile registers
are treated; it also causes the function to return using an exception
return instruction. This warning allows calls from one function with
the interrupt attribute to another, and the diagnostic text suggests
that not having the attribute on the callee is the problem. Actually
making such a call will lead to a double exception return, which is
unpredictable according to the ARM architecture manual section
B9.1.1, "Restrictions on exception return instructions". Even on
machines where an exception return from user/system mode is
tolerated, if the callee's interrupt type is anything other than a
supervisor call or secure monitor call, it will also return to a
different address than a normal function would. For example,
returning from an "IRQ" handler will return to lr - 4, which will
generally result in calling the same function again.
- It is part of the -Wextra diagnostic group and can't be individually
disabled when using -Wextra, which also means the diagnostic text of
this specific warning appears in the documentation of -Wextra.
This change addresses both issues. Rather than check that the callee has
the interrupt attribute, check that it uses the soft-float feature,
which will prevent use of VFP state. The warning is also given its own
diagnostic group.
Closes#34876.
callee1(); // expected-warning {{call to function without interrupt attribute could clobber interruptee's VFP registers}}
34
+
callee1(); // expected-warning {{calling a function from an interrupt handler could clobber the interruptee's VFP registers if the callee also uses VFP}}
callee3(); // expected-warning {{call to function without interrupt attribute could clobber interruptee's VFP registers}}
40
+
callee3(); // expected-warning {{calling a function from an interrupt handler could clobber the interruptee's VFP registers if the callee also uses VFP}}
0 commit comments