Bug #46311 [Asn]: Pointer aliasing issue results in miscompile on gcc4.4
| From: | dmitry@php.net | Date: | Tue, 19 Mar 2013 19:24:12 +0000 |
| Subject: | Bug #46311 [Asn]: Pointer aliasing issue results in miscompile on gcc4.4 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-177908@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=46311&edit=1
ID: 46311
Updated by: dmitry@php.net
Reported by: anton at samba dot org
Summary: Pointer aliasing issue results in miscompile on
gcc4.4
Status: Assigned
Type: Bug
Package: Compile Failure
Operating System: RHEL5.2 / PowerPC64
PHP Version: 5.2.9
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
This is not a PHP problem. The C code is absolutely legal and wrong compilation caused by a bug in
GCC or too aggressive optimization options that make wrong assumptions.
Previous Comments:
------------------------------------------------------------------------
[2013-03-19 18:51:42] olemarkus@php.net
The Gentoo patchset has been running with this for years now. Any reason why this
has not been resolved yet?
------------------------------------------------------------------------
[2010-07-25 02:17:06] mabi at gentoo dot org
There are Gentoo downstream bugs related to this issue:
https://bugs.gentoo.org/show_bug.cgi?id=295682
https://bugs.gentoo.org/show_bug.cgi?id=329753
I'd love to see this fixed upstream, but will ship a custom patch to get this more testing
shortly.
------------------------------------------------------------------------
[2008-10-16 09:35:17] johannes@php.net
Dmitry, can you check this?
------------------------------------------------------------------------
[2008-10-16 05:54:12] anton at samba dot org
To clarify... the Zend code reads via zval *, not long *. The cut down test case I submitted was
simplified to use a long *.
------------------------------------------------------------------------
[2008-10-16 03:20:35] anton at samba dot org
I can't work out how to attach things in this tool. Here is a copy and paste of it and a non
whitespace damaged version can be found at:
http://ozlabs.org/~anton/junkcode/php_fix_aliasing.patch
Index: php-5.2.6/Zend/zend_execute.h
===================================================================
--- php-5.2.6.orig/Zend/zend_execute.h 2007-12-31 02:20:02.000000000 -0500
+++ php-5.2.6/Zend/zend_execute.h 2008-10-15 23:03:01.000000000 -0400
@@ -150,7 +150,7 @@
EG(argument_stack).top -= (delete_count+2);
while (--delete_count>=0) {
- zval *q = *(zval **)(--p);
+ zval *q = *(--p);
*p = NULL;
zval_ptr_dtor(&q);
}
------------------------------------------------------------------------
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=46311
--
Edit this bug report at https://bugs.php.net/bug.php?id=46311&edit=1