Bernhard R. Link - Re: -Wuninitialized issues (original) (raw)

This is the mail archive of the gcc@gcc.gnu.orgmailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Why do you have to do something about a warning that is a clear false positive? With code like if( cond ) { sav = x; } bla; if( cond ) x = sav; I'd much prefer a warning about a "may be used uninitialized" on less clever compiler over the change to lose a "is used unitialized" warning some future more clever compiler may find if, say, cond is changed in between. Also placing a unconditional sav=0 before it all to silence it up I will lose any chance to have this found by valgrind.

Prior versions of GCC (and most other compilers) assumed that since somepredicate is passed the address of X, that it may initialize X, thus not emitting a warning at the use site. Newer versions of GCC inline somepredicate and then emit a bogus warning: "X" is only assigned to (and used) in the case where somepredicate returns true, and GCC loses this information (it is probably missing a jump threading opportunity).

While this is surely a regression w.r.t. false positives, I don't see how this is he result of "more clever", but mostly a side effect of better inlining that was not followed by making the warning code better to cope with such inlining.

Hochachtungsvoll, Bernhard R. Link


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]