Ticket #484 (closed bug: fixed)

Opened 13 years ago

Last modified 11 years ago

illegal instruction/segfault with Timer PMC

Reported by: coke Owned by: whiteknight
Priority: normal Milestone:
Component: none Version:
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

    .include 'timer.pasm'                   # for the timer constants

    .sub expired
       say 'Timer has expired!'
       exit 1
    .end

    .sub main :main
       $P0 = new 'Timer'
       $P1 = get_global "expired"

       $P0[.PARROT_TIMER_HANDLER] = $P1    # call sub in $P1 when timer goes off
       $P0[.PARROT_TIMER_SEC]     = 2      # trigger in 10 seconds
       $P0[.PARROT_TIMER_REPEAT]  = -1     # repeat indefinitely
       $P0[.PARROT_TIMER_RUNNING] = 1      # start timer immediately
       set_global "timer", $P0             # keep the timer around

       $I0 = 0
    loop:
       print $I0
       say ": running..."
       inc $I0
       sleep 1                             # wait a second
       goto loop
    .end

This generates an illegal instruction. Changing the -1 to a positive one, works as expected.

Change History

Changed 12 years ago by whiteknight

  • owner set to whiteknight

Changed 12 years ago by whiteknight

With repeat set to 1, I get this:

0: running...
1: running...
Timer has expired!
Segmentation fault

With repeat set to -1, I get this:

0: running...
1: running...
maximum recursion depth exceeded
current instr.: 'expired' pc 0 (test.pir:5)
called from Sub 'expired' pc 0 (test.pir:5)
... call repeated 1 times
called from Sub 'expired' pc 0 (test.pir:5)
... call repeated 1 times
called from Sub 'expired' pc 0 (test.pir:5)
... call repeated 1 times
called from Sub 'expired' pc 0 (test.pir:5)
... call repeated 1 times
called from Sub 'expired' pc 0 (test.pir:5)
... call repeated 1 times
called from Sub 'expired' pc 0 (test.pir:5)
... call repeated 1 times

Changed 12 years ago by whiteknight

(The above outputs are from r44242)

Changed 11 years ago by nwellnhof

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

Fixed in r48694

Note: See TracTickets for help on using tickets.