Skip to content

how to crash REPLICATE ? #1501

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

Closed
alaingdl opened this issue Feb 5, 2023 · 6 comments
Closed

how to crash REPLICATE ? #1501

alaingdl opened this issue Feb 5, 2023 · 6 comments

Comments

@alaingdl
Copy link
Contributor

alaingdl commented Feb 5, 2023

z=replicate(3,!values.f_nan)

z=replicate(3,!values.f_infinity) is OK

OK, I made a typo 🥲 (interverting first and second arg.)

(I am not sure to be able to look at that today)

@alaingdl
Copy link
Contributor Author

alaingdl commented Feb 6, 2023

What I was afraid of is confirmed 😢

IDL> B = BYTARR(2, !values.f_nan)
% Array dimensions must be greater than 0.

versus

GDL> B = BYTARR(2, !values.f_nan)
GDL> help, b
B               BYTE      = Array[2, 9223372036854775808]

We do face a serious problem, protecting all the inputs

@alaingdl
Copy link
Contributor Author

alaingdl commented Feb 6, 2023

identity( !values.f_nan) and z=findgen(3,!values.f_nan) crashed too ...

@jtappin
Copy link

jtappin commented Feb 8, 2023

IDL> B = BYTARR(2, !values.f_nan)
% Array dimensions must be greater than 0.

Isn't exactly suggestive of elegant handling of the case in IDL either.
A quick investigation suggests that when encountering a floating point dimension argument IDL computes LONG64, while GDL computes ULONG64. And long64(!values.f_nan) = -9223372036854775808 while
ulong64(!values.f_nan) = 9223372036854775808.

I don't think that's really the proper way to handle the situation though.

@GillesDuvert
Copy link
Contributor

I believe we should use LONG64 .

@alaingdl
Copy link
Contributor Author

I think we have an opportunity to deliver a clever message than IDL

It is not urgent, less urgent that "operational" bugs or regressions. Then we can think on solutions.
(if e->ParamIsNotFinite(2) then ...)

GillesDuvert added a commit to GillesDuvert/gdl that referenced this issue Feb 11, 2023
@GillesDuvert
Copy link
Contributor

the patch will be sufficient for the time being I believe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants