http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48580
--- Comment #7 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-04-12 21:16:41 UTC --- On Tue, 12 Apr 2011, zackw at panix dot com wrote: > Addendum: what would *you* describe as the correct C idiom for > ensuring that the product of two signed integers was positive and did > not overflow the range of a same-sized signed integer, assuming > nothing about either multiplicand? I think that's bordering complicated enough that any two people are likely to produce different enough code that it may not be worth detecting - the cases where generic C becomes complicated like that are the ones providing the best case for built-in operations where you can just say "multiply two (signed) values, check whether the result fits in 31-bit unsigned and set an overflow flag accordingly".