Messages in this thread | | | From | Evgenii Stepanov <> | Date | Tue, 14 Jun 2022 15:08:40 -0700 | Subject | Re: [PATCH] [RFC] Initialization of unused function parameters |
| |
On Tue, Jun 14, 2022 at 2:45 PM Segher Boessenkool <segher@kernel.crashing.org> wrote: > No such luck: the passing itself already causes UB. > > GCC does not warn, it has already optimised the code to what you expect > by the time this warning is done. If you use -fno-inline it does warn > for both "c" and "size" (via -Wmaybe-uninitialized). > > But it is still UB! All bets are off, no compiler can do any correct > translation of your program, since there *is none*.
Clang also puts "noundef" attribute on most function arguments in the frontend, and the optimizer can assume that the inputs are fully initialized. The diagnostic for this is very imperfect.
What Alex is proposing (the KMSAN option) takes place *after* inlining, so it will only enforce the "semantically meaningful" case in Linus's words.
| |