The following patch fixes what I presume is a typo in t/pmc/file.t.
Previously, I expect the only reason it was passing for some folks is that
unused I registers are somehow automatically set to 0 on Linux/x86.
--- parrot-current/t/pmc/file.t Sat Feb 25 00:32:34 2006
+++ parrot-andy/t/pmc/file.t Tue Apr 25 11:29:22 2006
@@ -84,7 +84,7 @@
$S1 = "xpto"
$I1 = $P1."is_file"($S1)
- $I1 = !I1
+ $I1 = !$I1
if $I1 goto ok1
print "not "
--
Andy Dougherty doug...@lafayette.edu
> The following patch fixes what I presume is a typo in t/pmc/file.t.
> Previously, I expect the only reason it was passing for some folks is that
> unused I registers are somehow automatically set to 0 on Linux/x86.
I'm not entirely sure that's true (but I don't have my test case to prove it),
but everything passes with this on Linux/PPC and it looks right.
Thanks, applied as #16031.
-- c
> Previously, I expect the only reason it was passing for some folks is
> that
> unused I registers are somehow automatically set to 0 on Linux/x86.
Unitialized I and N regs have more or less garbage. See also:
$ ./parrot --help-debug
$ ./parrot -D40 ...
> Unitialized I and N regs have more or less garbage.
Sort of. It turns out they are automatically set to 0 only for a
debugging build. For a non-debugging build, they also sometimes end up
being zero, but not always. This is likely architecture and compiler
dependent. In the past, this has masked at least three problems in the
test suite where uninitialized registers were inadvertantly used.
> See also:
> $ ./parrot --help-debug
> $ ./parrot -D40 ...
Unfortunately, that doesn't necessarily do anything. The problem is
that -D40 (unlike many of the other -D flags) is only effective if you
are running a debugging build, which I'm not.
$ cat try1.pir
.sub main :main
print "I1 = "
print I1
print "\n"
.end
$ ./parrot try1.pir
I1 = 0
$ ./parrot -D40 try1.pir
I1 = 0
Here's an example that does generate something in a non-initialized
register. It turns out to be rather sensitive to the details of the
file. Small changes make the value of '4437328' turn to either '37'
or '0'.
$ cat try2.pir
.sub main :main
$P1 = new .File
$S1 = "src"
$I1 = $P1."is_file"($S1)
print "$S1 = "
print $S1
print "\n"
print "$I1 = "
print $I1
print "\n"
print "I1 = "
print I1
print "\n"
ok1:
print "ok 1\n"
ok2:
print "ok 2\n"
end
.end
$ ./parrot try2.pir
$S1 = src
$I1 = 0
I1 = 4437328
ok 1
ok 2
--
Andy Dougherty doug...@lafayette.edu