Dean Mills Posted October 13, 2004 Report Share Posted October 13, 2004 Hi all, A collegue of my found this bug. There is a bug in LabVIEW 7.1 where if you have a for loop, a constant outside the loop and do simple math, such as subtract on a constant that resides inside the for loop it treats the top terminal as 0 . See attached. Directions Place a for loop on the diagram, wire 1 to the count terminal Place a constant on the diagram outside the for loop, use any postive number. Place a constant inside the for loop, use any positive number. Subtract them with the constant outside the for loop wired to the top terminal. Wire the result of the subtract to the output of the for loop, disable indexing. Wire the top terminal to the output of the for loop, disable indexing. Probe the output of the subtract. Run VI I have tried add, multiple and divide. Same bad results This has been submitted to NI as a bug report. DeanDownload File:post-5-1097694319.vi Quote Link to comment
Ed Dickens Posted October 13, 2004 Report Share Posted October 13, 2004 Interesting Changing either constant to a control makes it work correctly. It also works correctly in 7.0 and 6.1 with both values being constants. Ed Quote Link to comment
Barrie Posted October 13, 2004 Report Share Posted October 13, 2004 This has been submitted to NI as a bug report. DeanDownload File:post-5-1097694319.vi 2298[/snapback] VERY strange ! The inside indicator, a probe and execution highlighting all show the constant 60 as being passed correctly. If the inside and outside constants are reversed, the problem does not occur. If the outside constant is changed to an array, enabling auto indexing, the problem goes away. No similar bug exists in the while loop. I'm amazed that this bug has only surfaced now. Barrie Download File:post-658-1097697369.vi Quote Link to comment
Jeff B Posted October 19, 2004 Report Share Posted October 19, 2004 Hello LabVIEW Users, Thank you for reporting this issue. Prior to 10/13/2004, National Instruments was not aware of this issue, and we apologize for any inconvenience it has caused. We have since investigated this issue, and I would like to pass along more details about it. This issue occurs when a wire is connected to a For Loop, through the For Loop's diagram, and out the other side of the For Loop, with indexing disabled. Within the For Loop, the wire is branched to one of several operations such as Add, Subtract or Increment. When the original wire comes from a constant or a computed constant and all other wired inputs to the function are also constants or computed constants, the output of the function inside the For Loop can produce a wrong result. The wrong result will either be the constant value itself, or the result which would be produced by the default value for that type, depending upon the operation. While we feel that this issue should affect relatively few real-world applications, we are presently working on a longer-term solution for this, and will post more information in the NI Discussion Forum thread when it is available. Jeff Boettcher Product Support Engineer National Instruments - LabVIEW R&D Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.