diff options
author | Sara Golemon <pollita@php.net> | 2017-07-22 21:23:17 -0400 |
---|---|---|
committer | Sara Golemon <pollita@php.net> | 2017-07-22 21:23:17 -0400 |
commit | 1229b0f8cb483845e20d6687068a8c5edb79f5af (patch) | |
tree | 8648a3340f767d3c229fa3cca2e82c67d033f4fa /Zend | |
parent | c068818ff33b20a233b0e847f7787459a541249d (diff) | |
parent | c562d44321ea69612fbe3f7460055e9ed4340baa (diff) | |
download | php-git-1229b0f8cb483845e20d6687068a8c5edb79f5af.tar.gz |
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
Fix compile-time optimization of NAN comparisons
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_operators.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 418d2f03ea..7d53704da3 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -2166,6 +2166,16 @@ ZEND_API int ZEND_FASTCALL is_not_equal_function(zval *result, zval *op1, zval * ZEND_API int ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op2) /* {{{ */ { + if (UNEXPECTED((Z_TYPE_P(op1) == IS_DOUBLE) && isnan(Z_DVAL_P(op1)))) { + ZVAL_FALSE(result); + return SUCCESS; + } + + if (UNEXPECTED((Z_TYPE_P(op2) == IS_DOUBLE) && isnan(Z_DVAL_P(op2)))) { + ZVAL_FALSE(result); + return SUCCESS; + } + if (compare_function(result, op1, op2) == FAILURE) { return FAILURE; } @@ -2176,6 +2186,16 @@ ZEND_API int ZEND_FASTCALL is_smaller_function(zval *result, zval *op1, zval *op ZEND_API int ZEND_FASTCALL is_smaller_or_equal_function(zval *result, zval *op1, zval *op2) /* {{{ */ { + if (UNEXPECTED((Z_TYPE_P(op1) == IS_DOUBLE) && isnan(Z_DVAL_P(op1)))) { + ZVAL_FALSE(result); + return SUCCESS; + } + + if (UNEXPECTED((Z_TYPE_P(op2) == IS_DOUBLE) && isnan(Z_DVAL_P(op2)))) { + ZVAL_FALSE(result); + return SUCCESS; + } + if (compare_function(result, op1, op2) == FAILURE) { return FAILURE; } |