Bug #79356 [PATCH]: FFI:structure/union alignment [ext/ffi/tests/022.phpt] failure

[email protected] ("[email protected]")
Newsgroups php.bugs,php.qa
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=79356&edit=1

 ID:                 79356
 Patch added by:     [email protected]
 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)
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2020-03-09 05:49:17] 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?



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=79356&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.