From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8430 invoked by alias); 2 Feb 2010 10:10:06 -0000 Received: (qmail 8336 invoked by uid 48); 2 Feb 2010 10:09:52 -0000 Date: Tue, 02 Feb 2010 10:10:00 -0000 Subject: [Bug c/42935] New: Warning "u64 = u32 * u32;" - i.e. not casting one u32 to u64 X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "etienne_lorrain at yahoo dot fr" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-02/txt/msg00101.txt.bz2 It is a beginer bug, but it would be nice to get a warning in: #include unsigned val1 = 0x10000000, val2 = 0x100; int main(int argc, char **argv) { unsigned long long val3 = val1 * val2; printf ("val1 = 0x%X, val2 = 0x%X, val3 = 0x%llX, val1*val2 = 0x%llX\n", val1, val2, val3, (unsigned long long)(val1*val2)); } Obviously the line printed is: val1 = 0x10000000, val2 = 0x100, val3 = 0x0, val1*val2 = 0x0 (compiled with "gcc -w -Wall -O2 tmp.c" you get no warning) Got bitten yesterday by gcc-4.4.3, reproduced today on gcc version 4.1.2. -- Summary: Warning "u64 = u32 * u32;" - i.e. not casting one u32 to u64 Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: etienne_lorrain at yahoo dot fr 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