-
Notifications
You must be signed in to change notification settings - Fork 62
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
Assignment for an array element fails in a loop #1962
Comments
Thanks for the clear report. Two bad news :
|
IDL indeed gives
|
I wonder if this has not been around for a long time. |
This is a side-effect (totally unexpected) of the use of /NULL in
With the above code (
Meaning only 'new' code using /NULL in such circumstances could be affected. Now, this is still a bug and must be solved. |
Thanks for the workaround. But when I tried it, I ran into a completely different issue, as exemplified as follows:
which will print only the odd values. Even with hardcoded values, the if clause appears to evaluate to some false value for even numbers:
yields
I don't know what the actual expected (IDL) behaviour is for such cases where there is only an integer in the if-clause; I couldn't find where this is explicitly stated on the IDL manual pages (if this is documented somewhere). Perhaps it's even an actual error (or should be), or undefined behaviour, but someone else with IDL access will have test this. Of course, this is easy to work around: |
ignoreMe was not reset to 0 in AssignAt Probably other cases where !NULL is not properly handled will appear.
Just patched directly in master ( line 278 of arrayindexlistnoassoc.hpp ) |
The behaviour depends on
|
I have this simple procedure
When I run this (
gdl -X -e testarray
), the output iswhich is not what I expect: the -1 should be changed to 0, and only show up once in the output.
If I change
k
to 2, similar incorrect behaviour happens. But if I changek
to 0, the expected/correct behaviour happens (i.e., -1 shows up only once in the output).If I remove the loop (and the
j eq k
condition), I also observe the correct behaviour.I don't know if I'm missing something here, or whether this is an actual bug in GDL. (I am not able to test this behaviour with IDL.)
My set up is a Macbook Pro M1, Sonoma 14.6.1 (Darwin 23.6.0), running a self-installed GDL in the terminal (iTerm), with the GDL version given as GDL - GNU Data Language, Version v1.1-30-g35d32bbc.
The text was updated successfully, but these errors were encountered: