#1630: null arguments automatically coerce to empty strings
----------------------+-----------------------------------------------------
Reporter: pmichaud | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: none | Version: 2.0.0
Severity: medium | Keywords:
Lang: | Patch:
Platform: |
----------------------+-----------------------------------------------------
While working on PCT and POST updates today, I ran into the following:
{{{
pmich...@orange:~/parrot/trunk$ cat ../z.pir
.sub 'hello'
null $P0
'xyz'($P0)
.end
.sub 'xyz'
.param string abc
print "'"
print abc
print "'\n"
.end
pmich...@orange:~/parrot/trunk$ ./parrot ../z.pir
''
pmich...@orange:~/parrot/trunk$
}}}
The null PMC argument is automatically being coerced into an empty string,
instead of throwing a "Null PMC" exception. I spent a good hour chasing
down a problem in PCT due to this little buglet.
The behavior apparently changed sometime between 1.4.0 and 2.0.0 (probably
resulting from pcc changes):
{{{
pmich...@orange:~/parrot/RELEASE_1_4_0$ cat ../z.pir
.sub 'hello'
null $P0
'xyz'($P0)
.end
.sub 'xyz'
.param string abc
print "'"
print abc
print "'\n"
.end
pmich...@orange:~/parrot/RELEASE_1_4_0$ ./parrot ../z.pir
Null PMC access in get_string()
current instr.: 'xyz' pc 15 (../z.pir:7)
called from Sub 'hello' pc 10 (../z.pir:4)
pmich...@orange:~/parrot/RELEASE_1_4_0$
----
pmich...@orange:~/parrot/RELEASE_2_0_0$ cat ../z.pir
.sub 'hello'
null $P0
'xyz'($P0)
.end
.sub 'xyz'
.param string abc
print "'"
print abc
print "'\n"
.end
pmich...@orange:~/parrot/RELEASE_2_0_0$ ./parrot ../z.pir
''
pmich...@orange:~/parrot/RELEASE_2_0_0$
}}}
Pm
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/1630>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets