Bug #79356 [Asn->Csd]: FFI:structure/union alignment [ext/ffi/tests/022.phpt] failure
| From: | dmitry@php.net | Date: | Thu, 12 Mar 2020 08:52:13 +0000 |
| Subject: | Bug #79356 [Asn->Csd]: FFI:structure/union alignment [ext/ffi/tests/022.phpt] failure | ||
| References: | 1 | Groups: | php.bugs php.qa |
| Request: | Send a blank email to php-bugs+get-226045@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79356&edit=1
ID: 79356
Updated by: dmitry@php.net
Reported by: vibhutisawant18 at gmail dot com
Summary: FFI:structure/union alignment
[ext/ffi/tests/022.phpt] failure
-Status: Assigned
+Status: Closed
Type: Bug
Package: Testing related
Operating System: Ubuntu 16.04
PHP Version: master-Git-2020-03-09 (Git)
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
ext/ffi/tests/022.phpt failure is fixed by exporting FFI::__BIGGEST_ALIGNMENT__ constant.
Anyway, __attribute__((aligned)) without argument may cause invalid alignment assumption, if library
and PHP were compiled with different options. The same situation with C.
Previous Comments:
------------------------------------------------------------------------
[2020-03-11 12:34:34] dmitry@php.net
@nikic: I don't know, but in case GCC supports this, I would prefer to support this as well.
The proposed fix https://github.com/php/php-src/pull/5256
------------------------------------------------------------------------
[2020-03-11 09:11:56] nikic@php.net
@dmitry: Do you know of some particular case where this is being used?
------------------------------------------------------------------------
[2020-03-11 09:07:00] dmitry@php.net
I'm not sure, if we should remove support for __attribute__((aligned)) without specified
alignment completely. Probably, we should export __BIGGEST_ALIGNMENT__ constant and may be add a
warning about dependency.
------------------------------------------------------------------------
[2020-03-09 10:24:04] nikic@php.net
@dmitry: I would suggest that we remove support for __attribute__((aligned)) without specified
alignment, because it is not interoperable. If PHP was combined with a different target architecture
than the library we're linking against, the alignment will be incorrect. We should force an
explicit specification of the alignment instead. What do you think?
------------------------------------------------------------------------
[2020-03-09 10:21:18] nikic@php.net
Okay, I see now. __attribute__((aligned)) is the same as __attribute__((__BIGGEST_ALIGNMENT__)). I
happened to use an -march=sandybridge build, where __BIGGEST_ALIGNMENT__ is 32.
------------------------------------------------------------------------
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=79356
--
Edit this bug report at https://bugs.php.net/bug.php?id=79356&edit=1