On Sat, 30 Dec 2006, Gabriel Dos Reis wrote: > "Kaveh R. GHAZI" <[EMAIL PROTECTED]> writes: > > [...] > > | I'd like to see a -Warning flag added to GCC to spot places where GCC does > | something potentially too aggressive. Having that would do two things, it > | would make it easier for maintainers to audit their code, and it would > | make it easier for us to get hard data on how often code will break. > | There has been too much guessing and extrapolating in this discussion so > | far IMHO. > | > | Such a flag has been already suggested more than once. Here are two cases > | I found without trying too hard. > | http://gcc.gnu.org/ml/gcc/2006-12/msg00507.html > | http://lists.gnu.org/archive/html/bug-gnulib/2006-12/msg00151.html > | > | Is there some technical reason why we can't do this like we did for > | -Wstrict-aliasing? Would we get a zillion false positives? > > Indeed a warning for cases where we know GCC optimizers actively take > advantages of "undefined behaviour" will be very useful -- both for > checking and collecting data. Do we have an approximate list of those > cases used by the optimizers? > -- Gaby
Yes. In my followup to the first link above I found only 39 places where flag_wrapv is used. That should be an upper-bound on the number of places we'd have to hook the warning into. Ian does an excellent job of enumerating the different types of optimizations GCC performs in the second link. --Kaveh -- Kaveh R. Ghazi [EMAIL PROTECTED]