On 8/22/2011 5:22 PM, Richard Hipp wrote: > Consider this line of code in the "build.c" source file of SQLite:
> As it happens, the GCC bug is harmless in this case. SQLite never invokes > the sqlite3SrcListShiftJoinType() function with a non-NULL SrcList pointer > that has a NULL p->a value. So the p->a!=NULL test really is always true. > (Note that the GCC optimizer has no way of knowing that because the function > has external linkage.) And so it didn't matter that the test was omitted. > I didn't notice the problem until this morning, when I upgraded my desktop > to the latest Ubuntu containing GCC 4.5.2, and reran the full branch > coverage tests. GCC 4.5.2 was showing that the p->a!=NULL branch was always > true. Further investigation shows that it has always been always true but > that the GCC 4.1.0 bug simply masked the error up until now. > > I see two take-aways from this episode: > > (1) Compilers sometimes make mistakes. http://blog.regehr.org/ will agree with you, heartily. He is researching on the topic of compiler certification, testing, etc. > So it is important that you test > your object code - not just your source code. That means running your test > cases using exactly the same *.o files that you use for delivery. "Fly what > you test and test what you fly." > (2) I need to come up with a second, independent method of verifying branch > test coverage in SQLite. I have been using GCC+GCOV and it does a great job > and I fully intend to continue using it as the primary tool chain for > development and testing. But in this case, because GCC was omitting a test, > it missed the fact that there was no test coverage for the omitted test. So > it would be nice to have an independently developed tool chain that can be > used to confirm the results we get from GCOV. Anybody have any suggestions? While I do not know of additional tools you could use, maybe Mr Regehr above will. -- Andreas Kupries Senior Tcl Developer ActiveState, The Dynamic Language Experts P: 778.786.1122 F: 778.786.1133 andre...@activestate.com http://www.activestate.com Get insights on Open Source and Dynamic Languages at www.activestate.com/blog _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users