boostorg / boostorg/gil

Test channel/test_fixture does not work in BigEndian

Open
#498 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
199
Forks
171
Avg merge
1d 14h
Merged PRs (30d)
10

Description

[Issue200.txt](https://github.com/boostorg/gil/files/4651702/Issue200.txt)

### Actual behavior

Out of the 3 test_fixture tests, the "channel" one fails on AIX, which is BigEndian.
These 3 tests work perfectly both on Fedora/x86_64 and Fedora/PPC64LE , which are both LittleEndian.
This issue on AIX occurs with "unsigned int" and "long unsigned int" only. Not with "unsigned short" nor "unsigned long". 4 individual tests are failing.

I think that the issue comes from LittleEndian vs BigEndian. However, I haven't yet found the exact place and the root issue. Thus, I provide in the attached file traces from gdb done on AIX and Fedora/x86_64 . I hope that it may provide enough data for Boost.gil expert to understand the exact place where comes the issue.

./libs/gil/test/core/channel/test_fixture.cpp :
+204 std::uint16_t data_ = 0;
On Fedora/x86_64, a 16bit integer is used on the right part of a 32bit word. Though on AIX it makes use of the left part of the 32bit word. Moreover, addresses are not addressed in the same way (left to right on AIX). That may lead to issues.

On AIX, for "unsigned short", I see that copies are done that change data_ to 0xffff... , which is 65535 and is correct. However, for "unsigned int", I see that several attempts are done to write in data_ : however, each time the value to be copied is 0 , thus data_ never is 65535 but 0x0000.... instead .
On Fedora/x86_64, that works fine.

### Expected behavior

fix.data_ is expected to be 65535 though it is 0 for "unsigned int" cases.

The test_fixture shows the issue perfectly. No shorter program available for now.

### Environment

- Compiler version: GCC 8.4 or 9.3
- Build settings: g++ -O0 -g -gdwarf -fvisibility-inlines-hidden -fPIC -maix64 -pthread -mcmodel=large -fno-inline -Wall -fvisibility=hidden -ffp-contract=off -ftls-model=initial-exec -fstrict-aliasing -pedantic -Wextra -Wcast-align -Wconversion -Wfloat-equal -Wshadow -Wsign-promo -Wstrict-aliasing -Wunused-parameter -DBOOST_ALL_NO_LIB=1 -DBOOST_BEAST_ALLOW_DEPRECATED -DBOOST_BEAST_SEPARATE_COMPILATION -DBOOST_GIL_USE_CONCEPT_CHECK=1 -I.. -I../libs/gil/test
- Version (Git ref or ``): 1.73.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.