Bug #70173 [Com]: ZVAL_COPY_VALUE_EX broken for 32bit Solaris Sparc

From: Date: Sun, 09 Aug 2015 18:10:28 +0000
Subject: Bug #70173 [Com]: ZVAL_COPY_VALUE_EX broken for 32bit Solaris Sparc
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-195058@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70173&edit=1

 ID:                 70173
 Comment by:         rainer dot jung at kippdata dot de
 Reported by:        rainer dot jung at kippdata dot de
 Summary:            ZVAL_COPY_VALUE_EX broken for 32bit Solaris Sparc
 Status:             Analyzed
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Solaris 10 Sparc
 PHP Version:        7.0.0beta3
 Block user comment: N
 Private report:     N

 New Comment:

PR tested. Build succeeds, running test suite shows good results including the new test. Looks good
to me for merging. Thanks a bunch.


Previous Comments:
------------------------------------------------------------------------
[2015-08-09 14:28:05] cmb@php.net

You can find it on <https://github.com/php/php-src/pull/1464>.
(It's also linked further above in this ticket in the "Pull
Requests" section.)

------------------------------------------------------------------------
[2015-08-09 14:26:23] rainer dot jung at kippdata dot de

Ah, OK, found it at Github. I will add the change to my build and restest. Building and testing will
take a few hours. Thanks for the fast reaction!

------------------------------------------------------------------------
[2015-08-09 14:23:03] rainer dot jung at kippdata dot de

Where do I find "PR #1464"? Is there a typo (the number is very small).
I can test any suggested change.

------------------------------------------------------------------------
[2015-08-09 13:15:57] cmb@php.net

Thanks, Rainer, for the thorough analysis. AIUI the portable data
layout (ZEND_ENDIAN_LOHI) allows for more efficient operations[1].

PR #1464 is supposed to solve the issue. I do not have a
big-endian machine at hand, so I can't test it, though.

[1] <https://github.com/php/php-src/commit/d8099d0468426dbee59f540048376653535270ce>

------------------------------------------------------------------------
[2015-08-09 04:04:26] rainer dot jung at kippdata dot de

I removed the ZEND_ENDIAN_LOHI in front of w1, w2 and now the test suite results are in line with
the 5.6 ones.

I really don't see a reason, why the ZEND_ENDIAN_LOHI should be there. I always expect the
struct layout to have lval and dval start at the lower address, as well as w1 when ZEND_ENDIAN_LOHI
is removed. So for a 32 Bit build one then would always need to copy w2 in addition, which is what
the code currently does. Whether w1 resp. w2 contain least significant bits or most significant bits
soesn't matter, als long as bot are copied (and not used to interprete the two halves of the 64
bits individually).

If you really think you need the ZEND_ENDIAN_LOHI, then you also need to switch the additional
copying of w2 to w1 instead for big endian systems.

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


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=70173


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


Thread (16 messages)

« previous php.bugs (#195058) next »