Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51418 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16352 invoked from network); 1 Feb 2011 15:15:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Feb 2011 15:15:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=rquadling@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rquadling@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.177 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@gmail.com X-Host-Fingerprint: 209.85.216.177 mail-qy0-f177.google.com Received: from [209.85.216.177] ([209.85.216.177:46094] helo=mail-qy0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C7/11-07873-B83284D4 for ; Tue, 01 Feb 2011 10:15:23 -0500 Received: by qyk27 with SMTP id 27so6798572qyk.8 for ; Tue, 01 Feb 2011 07:15:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=WZqrWynmROaA1YgpX76nvkRxLprDJVRv963CfyiVqmY=; b=tyMJ5sRgI1lyVgpxKqkE4DauS5a6r0gv8M78sglZ8MF3w4Di3mxQD/Byf7Qa2UtnJk xWPNaU7tydhDZiAAbJ8pRzEPh3RjgLvBYO8sYw/IUubhFWl/3Ge2GAYtkSjokon3iUxr VAXgfIcb4m61yAXG/euRXsztTbFN5W0RoZ4AY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:content-type:content-transfer-encoding; b=KLnxjw+hfdn/frILay8I3Oj1ZtvvVjiWloT8Fu+4g/3aBEw0zPJLweXpfn4b7OFSUc a3tZ8KJ3lRE3+kJMp6mV8CLxOGtxEOGGSJuJzSlXzPvG3zQKpFouv9w6kD2+4PQOQaZr 8NuuzjI+A97OwEUhY4E1Uj3n0jlKKCdpOYapE= Received: by 10.229.249.78 with SMTP id mj14mr3570032qcb.25.1296573320645; Tue, 01 Feb 2011 07:15:20 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.100.130 with HTTP; Tue, 1 Feb 2011 07:15:00 -0800 (PST) Reply-To: RQuadling@googlemail.com In-Reply-To: <4D4821C7.2060108@hristov.com> References: <4D4821C7.2060108@hristov.com> Date: Tue, 1 Feb 2011 15:15:00 +0000 Message-ID: To: Andrey Hristov , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] size_t, casting and expression is always true (or false) From: rquadling@gmail.com (Richard Quadling) On 1 February 2011 15:07, Andrey Hristov wrote: > =C2=A0Hi Richard, > On 02/01/2011 02:35 PM, Richard Quadling wrote: >> Hi. >> >> I was looking at the cause for a test failing. >> >> It came down to ... >> >> size_t n; >> >> if (n < 0) { >> =C2=A0// Code never reached as n is unsigned and cannot be negative. >> } >> >> >> I'm not a strong c developer, but from reading it seems that size_t is >> always unsigned. >> >> Using the windows compiler (and turning on all the warnings via /Wall >> though /W4 should be enough), this warning reports as ... >> >> xxx\yyy.c(nnn) : warning C4296: '>=3D' : expression is always false >> >> I then ran a full build and extracted all the C4926 warnings. >> >> main\network.c(1175) : warning C4296: '>=3D' : expression is always true >> main\streams\filter.c(363) : warning C4296: '<' : expression is always f= alse >> main\streams\streams.c(921) : warning C4296: '>=3D' : expression is alwa= ys true >> ext\mysqlnd\mysqlnd.c(1006) : warning C4296: '>=3D' : expression is alwa= ys true >> ext\mysqlnd\mysqlnd.c(1031) : warning C4296: '>=3D' : expression is alwa= ys true >> ext\mysqlnd\mysqlnd_loaddata.c(215) : warning C4296: '<' : expression >> is always false >> ext\mysqlnd\mysqlnd_loaddata.c(223) : warning C4296: '<' : expression >> is always false >> ext\mysqlnd\mysqlnd_ps.c(1480) : warning C4296: '<' : expression is alwa= ys false >> ext\mysqlnd\mysqlnd_ps.c(1620) : warning C4296: '<' : expression is alwa= ys false >> ext\standard\ftp_fopen_wrapper.c(645) : warning C4296: '>=3D' : >> expression is always true >> ext\standard\image.c(645) : warning C4296: '<' : expression is always fa= lse >> ext\standard\streamsfuncs.c(637) : warning C4296: '>=3D' : expression is >> always true >> ext\standard\streamsfuncs.c(677) : warning C4296: '>=3D' : expression is >> always true >> ext\standard\var.c(403) : warning C4296: '<' : expression is always fals= e >> ext\pdo\pdo_stmt.c(463) : warning C4296: '<' : expression is always fals= e >> ext\soap\php_encoding.c(2794) : warning C4296: '<' : expression is alway= s false > > which mysqlnd/PHP sources did you use in your build? > >> In the case of the bug [1], the incorrect type comparison resulted in >> the suppression of an error which cased the test to fail, leading me >> here. >> >> I think other comparisons in the above list are also suppressing >> errors (I think mysqlnd will fail to report a loss of connection >> during mysqlnd_handle_local_infile() for example). >> >> Regards, >> >> Richard. >> >> [1] http://bugs.php.net/bug.php?id=3D49072 >> > > Best, > Andrey > php-src/branches/PHP5_3/ext/mysqlnd I've not run the code or any tests. I was just commenting on the parallels between bug#49072 and the code that is being reported. Richard. --=20 Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY