|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-03-09 05:49 UTC] vibhutisawant18 at gmail dot com
Description:
------------
FFI:structure/union alignment [ext/ffi/tests/022.phpt] fails on Big endian systems.
The TC fails in the following code block:
if (substr(PHP_OS, 0, 3) != 'WIN') {
test_size(32, "struct {char a; uint32_t b __attribute__((aligned));}");
test_align(16, "struct {char a; uint32_t b __attribute__((aligned));}");
}
The __attribute__((aligned(__BIGGEST_ALIGNMENT__))) returns 8 bytes on s390x, whereas its 16 bytes on x86 architecture.
Hence the test functions output observed on s390x is :
test_size expects the size returned to be 16.
test_align expects the alignment returned to be 8.
Added a patch with TC changes specific to s390x. Kindly let me know if I shall raise a PR with this changes.
Also Could you please ensure if additional source code changes are needed?
PatchesFFI_structure_union_alignment_s390x (last revision 2020-03-09 05:53 UTC by vibhutisawant18 at gmail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 09:00:01 2025 UTC |
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.