Ticket #1630 (closed bug: fixed)
null arguments automatically coerce to empty strings
Reported by: | pmichaud | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | none | Version: | 2.0.0 |
Severity: | medium | Keywords: | |
Cc: | Language: | ||
Patch status: | Platform: |
Description
While working on PCT and POST updates today, I ran into the following:
pmichaud@orange:~/parrot/trunk$ cat ../z.pir .sub 'hello' null $P0 'xyz'($P0) .end .sub 'xyz' .param string abc print "'" print abc print "'\n" .end pmichaud@orange:~/parrot/trunk$ ./parrot ../z.pir '' pmichaud@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):
pmichaud@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 pmichaud@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) pmichaud@orange:~/parrot/RELEASE_1_4_0$ ---- pmichaud@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 pmichaud@orange:~/parrot/RELEASE_2_0_0$ ./parrot ../z.pir '' pmichaud@orange:~/parrot/RELEASE_2_0_0$
Pm
Change History
Note: See
TracTickets for help on using
tickets.