Jump to content

Not a Refnum? Bug


Porter

Recommended Posts

I think that I've encountered a bug in the behavior of Not a Number/Path/Refnum? when checking an array of event references within a loop. *LabVIEW 19.0.1f3, 32-bit, Win10*

I would expect Loop1 (below) to stop within 6-7ms, however it is consistently timing out (>500ms). The result of the Not a Number/Path/Refnum? is always false even though the event refs are no longer valid.

Capture.PNG.b22740b9208dd3c3cb82aa934a024ad9.PNG

I suspect that this is related to compiler optimization because adding an in-place structure results in the correct behavior.

Capture2.PNG.b0090948b1de883557650340c75beca4.PNG

So is this actually a bug? or should the need for an in-place structure be expected for some reason?

Here is my test VI (LabVIEW 2019) to demonstrate this behavior: Destroyed Event Ref Test.vi

 

Link to comment

In the world of C it is up to us to declare variables such as those Refnums as 'volatile' so the compiler knows they may change despite the appearance of being loop invariants.  I would say it is a bug that the LV compiler does not treat Refnums as volatile.

I'd say most of your workarounds would work, but are in (slight) danger of being optimized away as the compiler improves.  Personally, I'd drop an 'Always Copy' node instead of the IPES.

  • Like 2
Link to comment
14 hours ago, Darin said:

In the world of C it is up to us to declare variables such as those Refnums as 'volatile' so the compiler knows they may change despite the appearance of being loop invariants.  I would say it is a bug that the LV compiler does not treat Refnums as volatile.

I'd say most of your workarounds would work, but are in (slight) danger of being optimized away as the compiler improves.  Personally, I'd drop an 'Always Copy' node instead of the IPES.

Thanks Darin for hitting the nail on the head. Always Copy was the first thing that came to mind when looking for a workaround, but muscle memory brought me to IPES first (which does the same thing if I recall correctly). For completeness, I have added Always Copy to Loop5 of my test vi. It solves the problem nicely:

Destroyed Event Ref Test_loop5.vi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.