------- Comment #6 from manu at gcc dot gnu dot org 2010-06-07 18:04 -------
I think the condition of this warning should be: warn if a binary operation is performed on a type but the result is then implicitly converted to a larger type. The workaround for a valid case should be casting to the same type as the result beforehand. For example: unsigned val1 = 0x10000000, val2 = 0x100; unsigned long long val3 = val1 * val2; // "warning: binary operation '*' is performed on type 'unsigned int' but the result is converted to type 'double'" unsigned long long val4 = (unsigned) (val1 * val2); // silence This probably can be implemented in convert_and_check in c-common.c or in build_binary_op in c-typeck.c. I am not working on this. -- manu at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- GCC build triplet|i686-pc-cygwin | GCC host triplet|i686-pc-cygwin | GCC target triplet|i686-pc-cygwin | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42935