This is the mail archive of the gcc@gcc.gnu.org mailing 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]

Re: Suspicion of regression in uninitialized value detection


On 12/6/2011 10:18 AM, David Brown wrote:

Unfortunately, there are no such tools available that compare with gcc
and its warnings.

It's surprising this is true of C, it's certainly not true of Ada, where CodePeer can do a much better job than GNAT+gcc together on this kind of issue.

Every time I have looked at this, I have always come back to gcc as the
best free general-purpose tool for static analysis.  I also think it has
the best starting point for such tools - after all, gcc does a great
deal of analysis on the code already, much of which would need
duplicating in a lint program.  I don't see any fundamental reason why a
linter could do any better than gcc for such warnings.

Well I am not sure what you mean by a linter or lint program, but obviously it is possible for a static analysis program to do far better than the compiler, since it can do inter-unit analysis that is out of reach of the compiler.

Don't get me wrong here - I understand that making accurate
uninitialised warnings is a hard problem, especially while producing
optimal code, and that it is not likely to be a high priority for the
gcc developers.  But I don't think I am alone in saying it is a feature
that gcc users appreciate, that we prefer not to see regressions in such
features, and that we would be very happy to see even more accurate
warnings.

One feature in GNAT that is really valuable for addressing uninitialized
variables is the option to set all otherwise uninitialized variables to a constant value that can be changed at bind time, or even at run time
with an environment variable. Then you run with different values, and if
you get a different behavior, you know you have an uninit variable.


Of course good compiler warnings, and warnings from a tool like codepeer
are very valuable in smoking out as many cases prior to testing as
possible.

mvh.,


David


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