From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 549 invoked by alias); 3 Aug 2008 19:04:39 -0000 Received: (qmail 541 invoked by uid 22791); 3 Aug 2008 19:04:39 -0000 X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 03 Aug 2008 19:03:57 +0000 Received: from mx10.gnu.org ([199.232.76.166]:36159) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1KPir2-0005W4-LN for gcc-help@gnu.org; Sun, 03 Aug 2008 15:02:57 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1KPirw-00053L-FE for gcc-help@gnu.org; Sun, 03 Aug 2008 15:03:55 -0400 Received: from rv-out-0708.google.com ([209.85.198.250]:8237) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KPirv-00050y-1I for gcc-help@gnu.org; Sun, 03 Aug 2008 15:03:51 -0400 Received: by rv-out-0708.google.com with SMTP id k29so1806384rvb.6 for ; Sun, 03 Aug 2008 12:03:49 -0700 (PDT) Received: by 10.141.113.6 with SMTP id q6mr7126756rvm.36.1217790229199; Sun, 03 Aug 2008 12:03:49 -0700 (PDT) Received: by 10.141.44.2 with HTTP; Sun, 3 Aug 2008 12:03:49 -0700 (PDT) Message-ID: Date: Sun, 03 Aug 2008 19:04:00 -0000 From: "Ankur Arora" To: gcc-help@gnu.org Subject: No warning on type truncation MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-08/txt/msg00023.txt.bz2 Hi, In the following program I am truncating a value from long to int (on a 64 bit machine): $ cat trunc.c int main() { int t2; long t1 = 0xfeed00000000; t2 = t1; return 0; } That, however doesn't result in any warnings even though -Wall and -Wextra are enabled: $ gcc -Wextra -Wall trunc.c $ gcc -v Using built-in specs. Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.1.2/work/gcc-4.1.2/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.2/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --disable-libgcj --enable-languages=c,c++,d,objc,obj-c++,treelang,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu Thread model: posix gcc version 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) (Gentoo 4.1.2 p1.1) I cannot find any relevant option in the manual which enables truncation warnings. What am I missing? Thanks, Ankur -- 667: The neighbor of the beast.