Ticket #1593 (closed bug: fixed)

Opened 12 years ago

Last modified 12 years ago

parrot puts an invalid value in a register when vtable override does not return as expected

Reported by: NotFound Owned by:
Priority: normal Milestone:
Component: none Version: 2.3.0
Severity: high Keywords:
Cc: Language:
Patch status: Platform:

Description

This shows the problem:

$ cat override.pir
.sub main
    $P0 = newclass ['Foo']
    $P1 = new $P0
    $P2 = $P1[0]
    say 'in main'
    print $P2
.end

.namespace [ 'Foo' ]

.sub get_pmc_keyed_int :vtable
    .param int i
    say 'Foo overrides'
.end
$ parrot override.pir
Foo overrides
in main
Segmentation fault (core dumped)

Oddly, it doesn't segfault in a non optimized build.

Change History

Changed 12 years ago by jkeenan

Additional testing data:

On Linux/i386, configured with --optimize, I get the same segfault as reported by NotFound.

On Linux/i386, configured without --optimize, I get:

Foo overrides
in main
P

... i.e., an unexpected P (with no newline following).

On Darwin/PPC, configured without --optimize, I get the desired results:

./parrot override.pir 
Foo overrides
in main

All tests run at r46014.

kid51

Changed 12 years ago by NotFound

The problem seems to be that the call to the vtable override does not fill the ->P result when there is no .return, and random garbage in the local variable is returned.

Worked around in r46482 by initializing the "result" local variable with PMCNULL.

Changed 12 years ago by NotFound

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

Added a reference to this ticket in the regression test in r47647. Closing.

Note: See TracTickets for help on using tickets.