Fix for failing tests. gcc 4.8.3 would optimize away the assigment.
authorKeyur Govande <keyur@php.net>
Fri, 26 Dec 2014 20:36:19 +0000 (20:36 +0000)
committerKeyur Govande <keyur@php.net>
Fri, 26 Dec 2014 20:36:19 +0000 (20:36 +0000)
ext/mysqlnd/mysqlnd_ps_codec.c

index d96091210b3a5802c4873e229f8da6e72dec82de..a57ff5d6a4e6a694fb26199bd50c56ed64cba180 100644 (file)
@@ -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;