From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21869 invoked by alias); 30 Sep 2012 06:52:35 -0000 Received: (qmail 21861 invoked by uid 22791); 30 Sep 2012 06:52:33 -0000 X-SWARE-Spam-Status: No, hits=-7.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 30 Sep 2012 06:52:25 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8U6qOo1030748 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 30 Sep 2012 02:52:24 -0400 Received: from host2.jankratochvil.net (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8U6qE1J026898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 30 Sep 2012 02:52:20 -0400 Date: Sun, 30 Sep 2012 06:52:00 -0000 From: Jan Kratochvil To: Siddhesh Poyarekar Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 0/4] bitpos expansion summary reloaded Message-ID: <20120930065211.GA21118@host2.jankratochvil.net> References: <20120927190053.1e7de264@spoyarek> <20120929173938.GA2987@host2.jankratochvil.net> <20120929181141.GA4009@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Disposition: inline In-Reply-To: <20120929181141.GA4009@host2.jankratochvil.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-09/txt/msg00709.txt.bz2 On Sat, 29 Sep 2012 20:11:41 +0200, Jan Kratochvil wrote: > On Sat, 29 Sep 2012 19:39:38 +0200, Jan Kratochvil wrote: > > We need to either fix splint or (more likely) use a different tool, there are > > too many cases missed this way. > > clang-3.0+ (Fedora-17+) can do it: > > $ clang -o t t.c -Wshorten-64-to-32 > t.c:5:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] > reported = longvar; > ~ ^~~~~~~ > t.c:6:12: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] > missed = longvar + a - b; > ~ ^~~~~~~~~~~~~~~ > 2 warnings generated. Or gcc with -Wconversion: t.c: In function ‘main’: t.c:5:3: warning: conversion to ‘int’ from ‘long int’ may alter its value [-Wconversion] t.c:6:24: warning: conversion to ‘int’ from ‘long int’ may alter its value [-Wconversion] With gcc-4.8+ featuring the carets: t.c: In function ‘main’: t.c:5:3: warning: conversion to ‘int’ from ‘long int’ may alter its value [-Wconversion] reported = longvar; ^ t.c:6:24: warning: conversion to ‘int’ from ‘long int’ may alter its value [-Wconversion] missed = longvar + a - b; ^ This way one can use --enable-targets=all currently incompatible with clang. Jan