Hi monks,
I'm running perl 5.8.8 on a SuSE 10.3 Xen guest and I am observing a rather strange array behaviour with the following program:
#!/usr/bin/perl use strict; use warnings; my $i = 0; BIGLOOP: while (1) { my @e; for my $j (0..@e / 2 - 1) { print "died where I shouldn't have: $i\n"; last BIGLOOP; } $i++; }
Since @e is empty when the 'for' statement is evaluated, the "print" should never be called. Instead, it is called sooner or later, or the program dies. Some examples:
main:~ # perl for.pl died where I shouldn't have: 19756054 main:~ # perl for.pl Range iterator outside integer range at for.pl line 11. main:~ # perl for.pl died where I shouldn't have: 5531064 main:~ # perl for.pl Illegal division by zero at for.pl line 11. main:~ # perl for.pl Illegal division by zero at for.pl line 11. main:~ # perl for.pl died where I shouldn't have: 24090 main:~ # perl for.pl died where I shouldn't have: 10987109 main:~ # perl for.pl died where I shouldn't have: 582219
... which means that at some point suddenly @e is not undef anymore.
I have a second VM installation on a different machine, there is no such effect. 'perl -V' is identical on those two systems. Also it's unlikely to be a memory problem: A memtest ran for hours without errors, and the very same Xen image on a different hardware shows the same problem. An strace shows also virtually no difference.
Do you have an idea how I could debug this further? Any help is appreciated.
Thank you!
Regards,
Thomas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |