Ticket #1630 (closed bug: fixed)

Opened 12 years ago

Last modified 11 years ago

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

Changed 11 years ago by Vasily Chekalkin

  • status changed from new to closed
  • resolution set to fixed

Don't coerce Null PMCs into values in PCC. Closes #1630

Changeset: 8ecae2661ca82dde9c4c334d1444367d18fe1dcb

Note: See TracTickets for help on using tickets.