jayduhon / inferno-os

Automatically exported from code.google.com/p/inferno-os
2 stars 0 forks source link

exprog panic #304

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The following program panics both my Linux/386 emu and Plan 9/386 emu; I 
haven't tested others. It doesn't panic if you get rid of A or add a sleep or 
something before the raise in B.

implement Panic;

include "sys.m";
include "exception.m";

Panic: module {
    init:   fn();
};

init()
{
    sys := load Sys Sys->PATH;
    exc := load Exception Exception->PATH;

    sys->pctl(Sys->NEWPGRP, nil);
    if(exc->setexcmode(Exception->NOTIFYLEADER) < 0) {
        sys->fprint(sys->fildes(2), "setexcmode: %r\n");
        raise "fail:setexcmode";
    }

    sync := chan of int;
    spawn A(sync);
    <-sync;

    spawn B();
}

A(sync: chan of int)
{
    ch := chan of int;
    sync <-= 69105;
    <-ch;
}

B()
{
    raise "fail:test";
}

# emu -d panic.dis
# panic: exprog - bad state 0x-21524111
# /emu/port/dis.c:/^exprog/+/panic/:        panic("exprog - bad state 0x%x\n", 
p->state);

Original issue reported on code.google.com by kristofwycz on 20 Dec 2013 at 3:50