05-05-2009 07:59 AM - edited 05-05-2009 08:01 AM
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.

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
Solved! Go to Solution.
05-05-2009 08:17 AM
05-05-2009 09:14 AM - edited 05-05-2009 09:14 AM
Hi,
i also don't see this behaviour. Tested with LV8.5.
Mike
05-05-2009 09:26 AM
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
05-05-2009 09:29 AM
05-05-2009 09:35 AM
05-05-2009 09:41 AM - edited 05-05-2009 09:45 AM
Hi Ben,
yes that's it.
Mike
05-05-2009 09:53 AM
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
05-05-2009 10:00 AM
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
05-05-2009 10:07 AM
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! ![]()
Maybe somebody else will be able to help, or find a useable workaround.