Re: com php-src: Fix for failing tests. gcc 4.8.3 would optimize away the assigment.: ext/mysqlnd/mysqlnd_ps_codec.c

From: Date: Sat, 27 Dec 2014 07:17:00 +0000
Subject: Re: com php-src: Fix for failing tests. gcc 4.8.3 would optimize away the assigment.: ext/mysqlnd/mysqlnd_ps_codec.c
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-83895@lists.php.net to get a copy of this message
On Fri, Dec 26, 2014 at 9:52 PM, Dmitry Stogov <dmitry@zend.com> wrote: > This patch increases the binary size on 2MB (20%) :( > > # without patch > > $ size sapi/cli/php > text data bss dec hex filename > 11243874 55868 134140 11433882 ae779a sapi/cli/php > > # with patch > > $ size sapi/cli/php > text data bss dec hex filename > 13398084 55888 134148 13588120 cf5698 sapi/cli/php > > It's probably better not to use dec32. > Ahh :( dec32 is 3 orders of magnitude faster than the alternative (convert float to a string via fcvt or gcvt, and then to double via strtod). That said though, I will make dec32 optional via a configure option defaulted to off and make the slow path the default. This will bring the Mysqli implementation in-line with what PDO-libmysqlclient does and fix the slight discrepancy in precision that arises due to that. dec32 is more precise, for example 3.141593 vs. 3.14159 with PDO-libmysqlclient when pi is stored in a Mysql 4 byte float column. I should have a pull request on Github in a day or two. > Thanks. Dmitry. > > On Fri, Dec 26, 2014 at 11:36 PM, Keyur Govande <keyur@php.net> wrote: > >> Commit: aa192f57c9d867ab3d7be69c7f269cfd7a10d14f >> Author: Keyur Govande <keyur@php.net> Fri, 26 Dec 2014 >> 20:36:19 +0000 >> Parents: 80260bcfa667bf25c65264b129f08a35059436a0 >> Branches: PHP-5.5 PHP-5.6 master >> >> Link: >> >> http://git.php.net/?p=php-src.git;a=commitdiff;h=aa192f57c9d867ab3d7be69c7f269cfd7a10d14f >> >> Log: >> Fix for failing tests. gcc 4.8.3 would optimize away the assigment. >> >> Changed paths: >> M ext/mysqlnd/mysqlnd_ps_codec.c >> >> >> Diff: >> diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c >> b/ext/mysqlnd/mysqlnd_ps_codec.c >> index d960912..a57ff5d 100644 >> --- a/ext/mysqlnd/mysqlnd_ps_codec.c >> +++ b/ext/mysqlnd/mysqlnd_ps_codec.c >> @@ -195,7 +195,8 @@ ps_fetch_float(zval * zv, const MYSQLND_FIELD * const >> field, unsigned int pack_l >> #ifdef HAVE_DECIMAL_FP_SUPPORT >> { >> typedef float dec32 __attribute__((mode(SD))); >> - dec32 d32val = fval; >> + /* volatile so the compiler will not optimize away the >> conversion */ >> + volatile dec32 d32val = fval; >> >> /* The following cast is guaranteed to do the right thing >> */ >> dval = (double) d32val; >> >> >> -- >> PHP CVS Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> >

« previous php.cvs (#83895) next »