lkml.org 
[lkml]   [2022]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [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.

\
 
 \ /
  Last update: 2022-06-15 00:09    [W:1.497 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site