Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx-r.one.com (mx-r.one.com [91.198.169.249])
	by mail6.b-one.net (Postfix) with ESMTP id 1DD668017F7F6
	for <filtered@awaresystems.be>; Fri,  6 Jul 2012 22:32:08 +0200 (CEST)
X-Virus-Scanned: by one.com
Received-SPF: pass (mx-r: domain of awaresystems.be+caf_=filtered=awaresystems.be@gmail.com designates 209.85.213.176 as permitted sender)
X-Greylist: whitelisted by SQLgrey-1.8.0-rc2
Received: from mail-yx0-f176.google.com (mail-yx0-f176.google.com [209.85.213.176])
	by mx-r.one.com (Postfix) with ESMTP id A2459EF34DC
	for <filtered@awaresystems.be>; Fri,  6 Jul 2012 20:32:07 +0000 (UTC)
Received: by yenl5 with SMTP id l5so11421886yen.21
        for <filtered@awaresystems.be>; Fri, 06 Jul 2012 13:32:07 -0700 (PDT)
Received: by 10.66.73.132 with SMTP id l4mr48075868pav.30.1341606726486;
        Fri, 06 Jul 2012 13:32:06 -0700 (PDT)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 10.143.92.14 with SMTP id u14csp81609wfl;
        Fri, 6 Jul 2012 13:32:05 -0700 (PDT)
Received: by 10.66.76.106 with SMTP id j10mr47794477paw.51.1341606724862;
        Fri, 06 Jul 2012 13:32:04 -0700 (PDT)
Received-SPF: softfail (google.com: best guess record for domain of transitioning tiff-bounces@lists.maptools.org does not designate 91.198.169.57 as permitted sender) client-ip=91.198.169.57;
Received: by 10.68.235.164 with POP3 id un4mf14280598pbc.18;
        Fri, 06 Jul 2012 13:32:04 -0700 (PDT)
X-Gmail-Fetch-Info: info@awaresystems.be 1 pop.awaresystems.be 110 info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-j.one.com (mx-j.one.com [91.198.169.57])
	by mail6.b-one.net (Postfix) with ESMTP id 8FB018017F7F3
	for <info@awaresystems.be>; Fri,  6 Jul 2012 22:26:51 +0200 (CEST)
X-Greylist: accepted by SQLgrey-1.8.0-rc2
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144])
	by mx-j.one.com (Postfix) with ESMTP id 305AA21D53F
	for <info@awaresystems.be>; Fri,  6 Jul 2012 20:26:51 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 3F9F21EDB4D;
	Fri,  6 Jul 2012 15:25:45 -0500 (EST)
Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com
	[209.85.217.172])
	by lists.maptools.org (Postfix) with ESMTPS id 94E671EDB48
	for <tiff@lists.maptools.org>; Fri,  6 Jul 2012 15:07:06 -0500 (EST)
Received: by lbbgo11 with SMTP id go11so13363436lbb.3
	for <tiff@lists.maptools.org>; Fri, 06 Jul 2012 13:07:05 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.112.36.132 with SMTP id q4mr14313204lbj.63.1341605225426; Fri,
	06 Jul 2012 13:07:05 -0700 (PDT)
Received: by 10.112.133.161 with HTTP; Fri, 6 Jul 2012 13:07:05 -0700 (PDT)
In-Reply-To: <alpine.GSO.2.01.1207061419280.27589@freddy.simplesystems.org>
References: <alpine.GSO.2.01.1207061419280.27589@freddy.simplesystems.org>
Date: Fri, 6 Jul 2012 16:07:05 -0400
Message-ID: <CAAcuQeakZZRzZL-e3-VVueON67+jAOs14Q6VMVDuPhsxV4CitQ@mail.gmail.com>
From: Olivier Paquet <olivier.paquet@gmail.com>
To: Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
Cc: Tiff List <tiff@lists.maptools.org>
Subject: Re: [Tiff] Challenge to properly eliminate warning
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

On Fri, Jul 6, 2012 at 3:28 PM, Bob Friesenhahn
<bfriesen@simple.dallas.tx.us> wrote:
> With libtiff CVS, GCC 4.7.0 produces this remaining warning when
> compiling the library:
>
> ../libtiff/tif_dirread.c: In function 'TIFFFetchNormalTag':
> ../libtiff/tif_dirread.c:4770:23: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized]
>
> It would be easy to quench this warning the easy way but I think that
> it would mask an error in the error handling logic.  I have not yet
> found the origin of the error.  It is useful to find the origin of the
> problem so that a proper error may be returned rather than using
> canned wrong data.

From similar problems in other code, I suspect it comes from all the
code of the form:

    err=TIFFReadDirEntryLong(tif,dp,&data);
    if (err==TIFFReadDirEntryErrOk)
    {
        if (!TIFFSetField(tif,dp->tdir_tag,data))
            return(0);
    }

    We rely on the fact that data is always initialized when
TIFFReadDirEntryLong returns no error. gcc most likely does not
understand such complex logic. It will figure that data is "not always
initialized" by the function and then later "potentially used".

Olivier
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
