From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116838 invoked by alias); 28 Apr 2017 00:35:38 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 116823 invoked by uid 89); 28 Apr 2017 00:35:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 spammy= X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx1.redhat.com DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 57136248525 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jistone@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 57136248525 Subject: Re: [PATCH] Avoid signed/unsigned comparison To: elfutils-devel@sourceware.org References: <1544575c-bba2-f196-3485-eb56b206b3d0@qt.io> <20170427182446.GD2061@stream> From: Josh Stone Message-ID: <3c091a11-b422-2079-c6fd-66ad26c1c433@redhat.com> Date: Fri, 28 Apr 2017 10:35:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 MIME-Version: 1.0 In-Reply-To: <20170427182446.GD2061@stream> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 28 Apr 2017 00:35:37 +0000 (UTC) X-SW-Source: 2017-q2/txt/msg00119.txt.bz2 On 04/27/2017 11:24 AM, Mark Wielaard wrote: > On Thu, Apr 20, 2017 at 04:40:30PM +0200, Ulf Hermann wrote: >> Some compilers implicitly cast the result of uint_fast16_t * >> uint_fast16_t to something signed and then complain about the >> comparison to (unsigned) size_t. > > Really? That is allowed? Using a signed type for uint_fast16_t? I think integer promotion (which happens before the operation) may use a signed int. It has to preserve the sign of the value itself, but I think not necessarily the signedness of the resulting type. Glibc uses "unsigned int"/"unsigned long int" for uint_fast16_t on 32/64-bit platforms, which means you won't get integer promotion.