-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug in tests/cunit/test_darray_async_many.c #1867
Comments
What should we do about it? |
Is this test meant to test overflow math or just int64 capabilities? If it is only meant to test int64 maybe different algebra or different numbers could be used that would test that both positive and negative values beyond regular int can be stored. Maybe something like:
|
This test is only to test int64, and overflow is accidental. I will try to see if I can verify this on my system, and then fix it... |
OK, I cannot reproduce this problem. test_darray_async_many works fine for me, even when I use CFLAGS='-O2'. Does this problem occur for you on the most recent release? Are you using GNU compilers? |
yes, the problem occurs with 2.5.3 and 2.5.4 (I have not tried compiling any other versions). I am using the Intel compilers and it happens at least as far back as version 17. I get the same behavior with version 17, 19 and 20 of the Intel compilers and only when activating optimizations. I have not tried the GNU compilers. |
OK I will change the data line as you suggest... |
Just to be clear, changing the arithmetic as I suggested should result in:
I have tested this with the Intel compiler with -g and -O3 and it works for me. I have not tested it with any other compilers. |
OK, I have made this change. PR up shortly... |
Hello,
As mentioned in #1862, cunit test
test_darray_async_many
fails for me on multiple systems. I have narrowed this down and possibly found a bug...at least when using Intel C compiler with anything but-g
for flags. This test was added in 2.2.2a and has remained largely unchanged since then. Intests/cunit/test_darray_async_many.c
, the following lines generate the data that is later compared to expected values:my_data_int64
is the entry that is causing me problems. The expected values are defined on these lines:This test is relying on overflow/wraparound math to get the values that end in 9. This works when only the -g flag is given. As soon as you add optimizations (including the default
-g -O2
) this no longer works and the calculated values inmy_data_int64
become 2147483657, -2147483637, 2147483667, -2147483627, 2147483677, and -2147483617. You can see that the addition ofmy_rank * 10
no longer results in negatives but simply adds 10, 20, and 30 to NC_MAX_INT (2147483647). I have only tested the default-g -O2
and-O3
. I have NOT tested-O1
.I have not been able to find an explanation of this so far but it seems that the optimization flags make it so the code no longer sees
NC_MAX_INT
as a regular integer and assumes it is2147483647LL
instead of just2147483647
.The text was updated successfully, but these errors were encountered: