[prev in list] [next in list] [prev in thread] [next in thread]
List: php-qa
Subject: Bug #79356 [Opn]: FFI:structure/union alignment [ext/ffi/tests/022.phpt] failure
From: nikic () php ! net
Date: 2020-03-09 10:24:04
Message-ID: E1jBFZs-00052c-E6 () bugs ! php ! net
[Download RAW message or body]
Edit report at https://bugs.php.net/bug.php?id=79356&edit=1
ID: 79356
Updated by: nikic@php.net
Reported by: vibhutisawant18 at gmail dot com
Summary: FFI:structure/union alignment
[ext/ffi/tests/022.phpt] failure
Status: Open
Type: Bug
Package: Testing related
Operating System: Ubuntu 16.04
PHP Version: master-Git-2020-03-09 (Git)
-Assigned To:
+Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
@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?
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2020-03-09 10:09:21] nikic@php.net
Something odd is going on here. The test passes for me on 7.4, but fails on master. \
Adding a bit more debug output I get:
FAIL: sizeof(struct {char a; uint32_t b __attribute__((aligned));})
Expected: 32
Actual: 64
FAIL: alignof(struct {char a; uint32_t b __attribute__((aligned));})
Expected: 16
Actual: 32
So I'm seeing a higher size/alignment for some reason.
------------------------------------------------------------------------
[2020-03-09 09:50:26] vibhutisawant18 at gmail dot com
ext/ffi/tests/022.phpt passed on x86-64.PFB the test log.
root@a11efdc33877:~/php/php-src# sapi/cli/php -f "ext/ffi/tests/022.phpt"
--TEST--
FFI 022: structure/union alignment
--SKIPIF--
--INI--
ffi.enable=1
--FILE--
ok
--EXPECT--
ok
root@a11efdc33877:~/php/php-src# arch
x86_64
root@a11efdc33877:~/php/php-src#
------------------------------------------------------------------------
[2020-03-09 08:17:12] nikic@php.net
This test also fails for me on a x86-64, so not big endian specific.
------------------------------------------------------------------------
[2020-03-09 05:53:16] vibhutisawant18 at gmail dot com
The following patch has been added/updated:
Patch Name: FFI_structure_union_alignment_s390x
Revision: 1583733196
URL: https://bugs.php.net/patch-display.php?bug=79356&patch=FFI_structure_union_alignment_s390x&revision=1583733196
------------------------------------------------------------------------
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic