From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7917 invoked by alias); 28 Jul 2015 18:55:12 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 7908 invoked by uid 89); 28 Jul 2015 18:55:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 28 Jul 2015 18:55:11 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 5C89F96C9; Tue, 28 Jul 2015 18:55:10 +0000 (UTC) Received: from redhat.com (ovpn-204-51.brq.redhat.com [10.40.204.51]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6SIt4x3010929 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Tue, 28 Jul 2015 14:55:07 -0400 Date: Tue, 28 Jul 2015 20:01:00 -0000 From: Marek Polacek To: Steve Ellcey Cc: Kyrill Tkachov , Jeff Law , Martin Sebor , GCC Patches , Joseph Myers , Jason Merrill Subject: Re: [C/C++ PATCH] Implement -Wtautological-compare (PR c++/66555, c/54979) Message-ID: <20150728185503.GD3335@redhat.com> References: <20150727161041.GT3335@redhat.com> <1438099371.19674.215.camel@ubuntu-sellcey> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1438099371.19674.215.camel@ubuntu-sellcey> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-07/txt/msg02401.txt.bz2 On Tue, Jul 28, 2015 at 09:02:51AM -0700, Steve Ellcey wrote: > Marek, > > I have run into a problem with this warning and building glibc. > > sysdeps/ieee754/s_matherr.c has: > > int > weak_function > __matherr(struct exception *x) > { > int n=0; > if(x->arg1!=x->arg1) return 0; > return n; > } > > > And arg1 is a floating point type. I think that if the value of > x->xarg1 is a NaN then the if statement should return TRUE because a NaN > never compares equal to anything, even another NaN (check with your > local IEEE expert). I believe this method of checking for a NaN is > fairly common and I am not sure if GCC should be emitting a warning for > it. Oh, you're right. In IEEE-754, NaN != NaN. So I need to adjust the warning and the documentation a bit. I suppose this is just about using get_inner_reference and punting for FLOAT_TYPE_P (I'll try to fix this tomorrow). This certainly didn't occur to me when I was writing the warning... Thanks for bringing this up. Marek