From:             anton at samba dot org
Operating system: Linux/RHEL5.2/PowerPC64
PHP version:      5.2.6
PHP Bug Type:     Compile Failure
Bug description:  Pointer aliasing issue results in miscompile on gcc4.4

Description:
------------
A recent checkout of gcc4.4 miscompiles php on PowerPC64. The following
function reads from p via long * and stores to p via void * which violates
aliasing rules:

static inline void zend_ptr_stack_clear_multiple(TSRMLS_D)
{
        void **p = EG(argument_stack).top_element-2;
        int delete_count = (int)(zend_uintptr_t) *p;

        EG(argument_stack).top -= (delete_count+2);
        while (--delete_count>=0) {
                zval *q = *(zval **)(--p);
                *p = NULL;
                zval_ptr_dtor(&q);
        }
        EG(argument_stack).top_element = p;
}

More details can be found at:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37824

We can remove the (zval **) cast so that we read and write via void *p and
fix the aliasing issue. I will attach a patch.


-- 
Edit bug report at http://bugs.php.net/?id=46311&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=46311&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=46311&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=46311&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=46311&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=46311&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=46311&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=46311&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=46311&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=46311&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=46311&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=46311&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=46311&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=46311&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=46311&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=46311&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=46311&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=46311&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=46311&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=46311&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=46311&r=mysqlcfg

Reply via email to