Fanning Software Consulting

Dictionary Dereference Bug Crashes IDL

Facebook Twitter RSS Google+

QUESTION: I've came across an problem using dictionaries and dot syntax to dereference the value. This bug is easy to reproduce, but it will cause IDL to crash hard on my Windows machine. IDL simply disappears and I'm left with a bug report.

Disclaimer: If you test this code, I will not be responsible for any data loss or damages of any kind (PC burning, earthquakes, losses at the stock exchange,...) resulting from it!

Here we go:

   IDL> a = dictionary()
   IDL> a['item'] = 0l
   IDL> a.item++   ; Source of the crash

This array syntax is fine.

   IDL> a['item']++ 

Both IDL 8.3 and IDL 8.4 exhibit this behavior on my Windows machine.

ANSWER: Yes, this is reported to be a critical bug in both IDL 8.3 and IDL 8.4. Interestingly enough, the "fix" you have found appears to throw an error in UNIX versions of IDL 8.3. Here is an example of an IDL session on a LINUX machine running IDL 8.3.

   IDL> a = dictionary()
   IDL> a['item'] = 0l
   IDL> a.item++
   IDL> a
        "item": 0
   IDL> a['item']++
   % Type conversion error: Unable to convert given STRING to Long64.
   % Detected at: $MAIN$
   % Object reference expression not allowed in this context: A.
   % Execution halted at: $MAIN$

Version of IDL used to prepare this article: IDL 8.4.

Written: 30 Oct 2014