Bug #79595 [ReO]: zend_init_fpu() alters FPU precision

From: Date: Tue, 26 May 2020 07:03:48 +0000
Subject: Bug #79595 [ReO]: zend_init_fpu() alters FPU precision
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227166@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79595&edit=1

 ID:                 79595
 Updated by:         cmb@php.net
 Reported by:        v-yitam at microsoft dot com
 Summary:            zend_init_fpu() alters FPU precision
 Status:             Re-Opened
 Type:               Bug
 Package:            Math related
 Operating System:   Alpine Linux
 PHP Version:        7.4.5
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Thanks for checking, and yes, this was helpful!  I had forgotten
to add the guard to that #elif[1].

[1] <https://github.com/php/php-src/pull/5621/commits/c3fe3f7424b7e9a793ef4b55f197de9e2b6593af>


Previous Comments:
------------------------------------------------------------------------
[2020-05-25 17:15:17] v-yitam at microsoft dot com

Thank you all for working hard on fixing this issue. I just tested the new proposed fix but
unfortunately it didn't work in Alpine Linux. I added the following 'debugging' lines
in zend_float.c:

ZEND_API void zend_init_fpu(void) /* {{{ */                                
{                                                                          
int x = -1;                                                                
#if defined(HAVE__CONTROLFP_S) && !defined(__x86_64__)                     
    x = 1;                                                                 
#elif defined(HAVE__CONTROLFP) && !defined(__x86_64__)                     
    x = 2;                                                                 
#elif defined(HAVE__FPU_SETCW)  && !defined(__x86_64__)                    
    x = 3;                                                                 
#elif defined(HAVE_FPSETPREC)  && !defined(__x86_64__)                     
    x = 4;                                                                 
#elif defined(HAVE_FPU_INLINE_ASM_X86)                                     
    x = 5;                                                                 
#else                                                  
    x = 0;                                             
#endif         


Then I ran the debugger:


Breakpoint 1, zend_init_fpu ()
    at /home/jennyt/php-7.4.6/Zend/zend_float.c:24
24	{
(gdb) s
25	int x = -1;
(gdb) s
36	    x = 5;
(gdb)



Hope this helps!

------------------------------------------------------------------------
[2020-05-25 08:41:01] cmb@php.net

The fix had to be reverted due to unforeseen issues on
i386.  PR #5621 is hopefully a better fix.

------------------------------------------------------------------------
[2020-05-25 08:40:08] cmb@php.net

The following pull request has been associated:

Patch Name: Fix #79595: zend_init_fpu() alters FPU precision
On GitHub:  https://github.com/php/php-src/pull/5621
Patch:      https://github.com/php/php-src/pull/5621.patch

------------------------------------------------------------------------
[2020-05-22 14:57:34] nikic@php.net

Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=10eb842a6434f7b05dbb8676da57ada445f4434f
Log: Revert &quot;Fix #79595: zend_init_fpu() alters FPU precision&quot;

------------------------------------------------------------------------
[2020-05-22 13:50:16] cmb@php.net

The fix is scheduled to be released with PHP 7.4.7.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=79595


--
Edit this bug report at https://bugs.php.net/bug.php?id=79595&edit=1


Thread (21 messages)

« previous php.bugs (#227166) next »