[php-src] Issue #10271: Incorrect arithmetic calculations when using JIT (2)

From: Date: Mon, 09 Jan 2023 16:12:17 +0000
Subject: [php-src] Issue #10271: Incorrect arithmetic calculations when using JIT (2)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243383@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10271 Author: GajowyJ ### Description This bug is the same as https://github.com/php/php-src/issues/10195. The previous ticket one was closed because it has not been confirmed in 8.1.13. Unfortunatelly, it was my mistake (zend extenstion not loaded in php.ini). When repeated with correct setting the issue appeared. Additional informations: tests showed that the value of $sol['xc'] and $sol['yc'] variables in line 6 and 7 below behave as they were both equal =1 (and in fact are not!). ``` 1 function Tangential2XY($tang,$sol) 2 { 3 $x = $sol['X']['k']*$tang['KSI'] + $sol['X']['e']*$tang['ETA'] + $sol['X'][1]; 4 $y = $sol['Y']['k']*$tang['KSI'] + $sol['Y']['e']*$tang['ETA'] + $sol['Y'][1]; 5 printf("In;%.12f;%.12f;%.12f;%.12f;",$x,$y,$sol['xc'],$sol['yc']); 6 $x = $sol['xc']*($x+1); 7 $y = $sol['yc']*($y+1); 8 printf("Out;%.12f;%.12f\n",$x,$y); 9 return ['x'=>$x,'y'=>$y]; 10 } ``` produces when JIT enabled: In;0.005909845561;0.003134992878;968.000000000000;548.000000000000;Out;1.005909845561;1.003134992878 ...and when JIT disabled (correct values): In;0.005909845561;0.003134992878;968.000000000000;548.000000000000;Out;973.720730502727;549.717976097410 It is important to mention that sometimes the same function works correctly, however it's not random - the problem appears exactly in the same place of code execution. From other hand skipping part of the unrelated code causes the problem appears in another place or doesn't appear at all. ### PHP Version PHP 8.1.13 ### Operating System Windows 10

« previous php.bugs (#243383) next »