Skip to content
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

GDL can crash if you really want it #1634

Closed
GillesDuvert opened this issue Sep 9, 2023 · 0 comments
Closed

GDL can crash if you really want it #1634

GillesDuvert opened this issue Sep 9, 2023 · 0 comments
Labels

Comments

@GillesDuvert
Copy link
Contributor

GDL> FOR i = 1L, 3 DO a = temporary(i) + 1
Segmentation fault (core dumped)

IDL sees the trick 😄

GillesDuvert added a commit to GillesDuvert/gdl that referenced this issue Sep 10, 2023
FOR i = 1L, 3 DO a = temporary(i) + 1  --> % Variable is undefined: I.
Also, reverted FOREACH code to older, less optimized version as IDL does not complain on constructs such as:
 i=findgen(33) & foreach j,i do a=temporary(j) which is possible to reproduce with GDL.

Note that 
GDL> i=findgen(33) & foreach j,i do a=temporary(i)
% TEMPORARY: Variable is undefined: I
when
IDL> i=findgen(33) & foreach j,i do a=temporary(i)
IDL> help,a
A               FLOAT     = Array[33]
This discrepancy existed since GDL's fundation, and getting the IDL behaviour would be complicated, although it may be that TEMPORARY just removes a reference to the variable, in which case loops variables may just need to have their reference number incremented. TBC.
GillesDuvert added a commit that referenced this issue Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant