Ticket #714 (closed bug: fixed)

Opened 13 years ago

Last modified 13 years ago

can't copy undef to null

Reported by: coke Owned by: whiteknight
Priority: trivial Milestone:
Component: none Version: trunk
Severity: low Keywords:
Cc: Language:
Patch status: Platform:

Description

This used to work (unknown rev) but now fails in svn latest:

.sub main :main
  null $P1
  $P2 = new 'Undef'
  copy $P1, $P2
.end

It should end silently, but dies with:

Null PMC access in getprops()
current instr.: 'main' pc 5 (foo.pir:4)

Change History

Changed 13 years ago by whiteknight

  • owner set to whiteknight
  • status changed from new to assigned

I'm pretty sure the problem lies in the copy opcode, it doesn't do enough error checking for this kind of stuff.

Changed 13 years ago by whiteknight

Actually, now that I look at this example in more detail, it's nonsensical. A copy operation takes the contents of one PMC and copies them into another PMC. Nowhere in the semantic meaning of copy is there the phrase "...and create the destination if it does not exist".

We can (and probably should) throw a better error message in this case, but an error message is IMO the correct result.

Changed 13 years ago by coke

  • keywords tcl blocker removed
  • priority changed from major to trivial
  • severity changed from medium to low

Fair enough. I will route around this in partcl. Leaving the ticket open in case we do want to change the error message here.

Changed 13 years ago by NotFound

Added a better exception trhowing (EXCEPTION_NULL_REG_ACCESS, "Null PMC in copy") and a test for it in r39197, r39198 and r39199

Changed 13 years ago by whiteknight

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

Okay, I'm marking this ticket as resolved now, pending any disagreements that this is the correct semantics.

Note: See TracTickets for help on using tickets.