algorithm_channel_arithmetic test seems random
- Dominant language
- C++
- Stars
- 199
- Forks
- 171
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 10
Description
### Actual behavior
Porting Boost 1.69 to AIX, I see the test **algorithm_channel_arithmetic** failing on AIX randomly (depending on the -O? option I use).
Then, looking at Fed/Intel, though the test seems to succeed, I see that intermediate values are random, probably being the root cause of my issue on AIX.
With same executable (built with addition of one line of printf in file below) on Fed/Intel:
../bin.v2/libs/gil/test/channel/algorithm_channel_arithmetic.test/gcc-9.2.1/debug/visibility-hidden/**algorithm_channel_arithmetic** , and launching it several times, I have the following different results:
```
1)
TONY: BEG f.min_v_: 0l f.max_v_: 255l
TONY: BEG f.min_v_: 4294967168l f.max_v_: 127l
TONY: BEG f.min_v_: 0l f.max_v_: 65535l
TONY: BEG f.min_v_: 4294934528l f.max_v_: 32767l
TONY: BEG f.min_v_: 0l f.max_v_: 4294967295l
TONY: BEG f.min_v_: 2147483648l f.max_v_: 2147483647l
TONY: BEG f.min_v_: 168336160l f.max_v_: 168336192l <===
TONY: BEG f.min_v_: 168336176l f.max_v_: 168336208l
TONY: BEG f.min_v_: 0l f.max_v_: 255l
2)
TONY: BEG f.min_v_: 0l f.max_v_: 255l
TONY: BEG f.min_v_: 4294967168l f.max_v_: 127l
TONY: BEG f.min_v_: 0l f.max_v_: 65535l
TONY: BEG f.min_v_: 4294934528l f.max_v_: 32767l
TONY: BEG f.min_v_: 0l f.max_v_: 4294967295l
TONY: BEG f.min_v_: 2147483648l f.max_v_: 2147483647l
TONY: BEG f.min_v_: 4049837264l f.max_v_: 4049837296l <===
TONY: BEG f.min_v_: 4049837280l f.max_v_: 4049837312l
TONY: BEG f.min_v_: 0l f.max_v_: 255l
3)
TONY: BEG f.min_v_: 0l f.max_v_: 255l
TONY: BEG f.min_v_: 4294967168l f.max_v_: 127l
TONY: BEG f.min_v_: 0l f.max_v_: 65535l
TONY: BEG f.min_v_: 4294934528l f.max_v_: 32767l
TONY: BEG f.min_v_: 0l f.max_v_: 4294967295l
TONY: BEG f.min_v_: 2147483648l f.max_v_: 2147483647l
TONY: BEG f.min_v_: 3091145712l f.max_v_: 3091145744l <===
TONY: BEG f.min_v_: 3091145728l f.max_v_: 3091145760l
TONY: BEG f.min_v_: 0l f.max_v_: 255l
4)
TONY: BEG f.min_v_: 0l f.max_v_: 255l
TONY: BEG f.min_v_: 4294967168l f.max_v_: 127l
TONY: BEG f.min_v_: 0l f.max_v_: 65535l
TONY: BEG f.min_v_: 4294934528l f.max_v_: 32767l
TONY: BEG f.min_v_: 0l f.max_v_: 4294967295l
TONY: BEG f.min_v_: 2147483648l f.max_v_: 2147483647l
TONY: BEG f.min_v_: 2127298960l f.max_v_: 2127298992l <===
TONY: BEG f.min_v_: 2127298976l f.max_v_: 2127299008l
TONY: BEG f.min_v_: 0l f.max_v_: 255l
```
However, on AIX, when it breaks with errors, I ALWAYS have:
```
TONY: BEGINNING f.min_v_: 0l f.max_v_: 255l
TONY: BEGINNING f.min_v_: 4294967168l f.max_v_: 127l
TONY: BEGINNING f.min_v_: 0l f.max_v_: 65535l
TONY: BEGINNING f.min_v_: 4294934528l f.max_v_: 32767l
TONY: BEGINNING f.min_v_: 0l f.max_v_: 4294967295l
TONY: BEGINNING f.min_v_: 2147483648l f.max_v_: 2147483647l
TONY: BEGINNING f.min_v_: 4294954660l f.max_v_: 4294954656l <===
TONY: BEGINNING f.min_v_: 4294954536l f.max_v_: 4294954528l
TONY: BEGINNING f.min_v_: 0l f.max_v_: 255l
```
But, still on AIX, this generates errors:
```
+ ../bin.v2/libs/gil/test/channel/algorithm_channel_arithmetic.test/gcc-8.4.0/debug/address-model-64/visibility-hidden/algorithm_channel_arithmetic
Running 30 test cases...
../libs/gil/test/channel/algorithm_channel_arithmetic.cpp(54): error: in "packed_channel_reference": check f.min_v_ > f.max_v_ has failed [ <= ]
../libs/gil/test/channel/algorithm_channel_arithmetic.cpp(58): error: in "packed_dynamic_channel_reference": check v2 == v3 has failed [ != ]
../libs/gil/test/channel/algorithm_channel_arithmetic.cpp(58): error: in "packed_dynamic_channel_reference": check v2 == v3 has failed [ != ]
```
### Expected behavior
I expect the intermediate values of f.min_v_ and f.max_v_ to be the same when I run the test.
I'd like someone checking that this issue does appear in the official Boost environment.
### C++ Minimal Working Example
Let's add a printf line at the begining of the test_channel_arithmetic_mutable() routine of the file libs/gil/test/channel/algorithm_channel_arithmetic.cpp .
```
libs/gil/test/channel/algorithm_channel_arithmetic.cpp :
template
void test_channel_arithmetic_mutable(boost::mpl::true_)
{
using fixture_t = fixture::channel;
using channel_value_t = typename fixture_t::channel_value_t;
fixture_t f;
channel_value_t const v = f.min_v_;
printf("TONY: BEG f.min_v_: %ul f.max_v_: %ul \n", f.min_v_, f.max_v_ );
....
```
### Environment
- Compiler version: GCC 9.3.1 20200408 (Red Hat 9.3.1-2)
- Build settings:
- Version (Git ref or ``): v1.69
Contributor guide
Assessment
This issue has not been assessed yet.