On 9/29/17 2:58 PM, J Decker wrote:
20 warnings “cast discards __attribute__((noreturn))” like:
SQLite3.c:55734:10: warning: cast discards ‘__attribute__((noreturn))’
qualifier from pointer target type [-Wcast-qual]
memcpy((void*)&aHdr[1], (const void*)&pWal->hdr, sizeof(WalIndexHdr));
768 warnings “may change the sign of the result” like:
SQLite3.c:19330:11: warning: conversion to ‘unsigned int’ from ‘int’ may
change the sign of the result [-Wsign-conversion]
75 warnings “signed overflow” like:
SQLite3.c:61116:3: warning: assuming signed overflow does not occur when
reducing constant in comparison [-Wstrict-overflow]
As a result I would like to recommend to build SQLite with all extra
warning options. In total, I have counted unbelievable 2628 warnings of
potential errors without any efforts from my side.
As for the above... those can be catastrophic; and I'm surprised there are
so many sign conversion warnings generated...
Note, the warning doesn't say that an overflow has/will occur, just that
it assumed it won't and optimized based on that. If the program took
care to avoid overflow, all is good. If the program made the (invalid)
assumption that signed arithmetic wrapped on overflow like unsigned,
then the program has a problem.
My guess is that the code is good enough not to have the overflow issue.
That sort of warning is aimed at 'sloppy programmers' who think that
just because it seems to work, it must be right and to the standard.
--
Richard Damon
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users