LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bug in conditional for loop with an empty array

Solved!
Go to solution

There appears to be a bug in the for loop with a conditional terminal.

 

If an empty array is wired to an auto-indexed array input tunnel, an output array tunnel has one element instead of zero.

 

 For loop bug example

 

The array constant on the left is empty.

Top loop without the conditional terminal produces an empty array.

The bottom loop with a never true conditional terminal produces an array with one element

 

Using LabVIEW version 8.5

Message Edited by TrevMrgn on 05-05-2009 02:01 PM
0 Kudos
Message 1 of 19
(4,789 Views)
Just for info - this doesn't occur in LV8.6. Both array indicators are empty.
Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 2 of 19
(4,781 Views)

Hi,

i also don't see this behaviour. Tested with LV8.5.

 

Mike

Message Edited by MikeS81 on 05-05-2009 04:14 PM
0 Kudos
Message 3 of 19
(4,755 Views)

When constant folding was first introduced there was a bug that would show up only if either

 

Options >>> Block Diagram >>> Show Constant folding of wires

or

Options >>> Block Diagram >>> Show Constant folding of strutures

 

was turned on.

 

maybe that makes a difference?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 19
(4,743 Views)
Nor in 8.5.1 in WinXP SP3.
Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 5 of 19
(4,738 Views)

Ben,

I cannot replicate this behaviour in 8.5.1 with any of the constant folding options on and/or off.

Looking at the author's screenshot, constant folding of both wires and structures is on.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 6 of 19
(4,726 Views)

Hi Ben,

yes that's it.

 

Mike

Message Edited by MikeS81 on 05-05-2009 04:45 PM
0 Kudos
Message 7 of 19
(4,718 Views)

I have done some more testing on this.

Creating the example from scratch, I do not see the error.

 

If I add one or more elements to the array (constant or control), then delete them all (using 'Delete Element') the bottom array has one element.

If I empty the array (using 'Empty Array') both are empty.

 

Also if I create an empty array using 'initialise array' with zero elements, I get one element.

 

'Show constant folding' does not appear to change the behaviour, but including a random operation in the loop does.

 

Trevor

0 Kudos
Message 8 of 19
(4,707 Views)

Please post to demonstarte this condition along with a step by step instructions to reproduce it.

 

It we can follow your instructions and reproduce it we can log this as a bug.

 

Lacking the ability to reproduce.... there is very little any one can do.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 19
(4,696 Views)

Creating the example from scratch, I do not see the error.

Neither do I.


If I add one or more elements to the array (constant or control), then delete them all (using 'Delete Element') the bottom array has one element.

Nup. Still empty.


If I empty the array (using 'Empty Array') both are empty.


Yep.


Also if I create an empty array using 'initialise array' with zero elements, I get one element.


Nup. Still empty.


'Show constant folding' does not appear to change the behaviour, but including a random operation in the loop does.


Agreed that constant folding doesn't cause any odd behaviour. Introducing a random operation (adding two constants) in the loop doesn't either.

 

I've tried all your methods here Trevor, but I can't replicate this behaviour in 8.5.1 under WinXP SP3. Sorry! Smiley Sad

 

 Maybe somebody else will be able to help, or find a useable workaround.

 

 

 

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 10 of 19
(4,694 Views)