[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#447036: gnumach: panic: fp_intr: already caught intr



Package: gnumach
Version: 2:1.3.99.dfsg.cvs20070809-1

I get the following panic during configure of erlang ("checking for
unreliable floating point execptions"):

panic: fp_intr: already caught intr
Kernel Breakpoint trap, eip 0x117d07
Stopped at 0x117d06: int $3

The trace is:

0x117d06
Debugger
/build/buildd/gnumach-1.3.99.dfsg.cvs20070809/build-dbg/../kern/debug.c:101
0x117cd3
panic
/build/buildd/gnumach-1.3.99.dfsg.cvs20070809/build-dbg/../kern/debug.c:143
0x100f58
fpintr
/build/buildd/gnumach-1.3.99.dfsg.cvs20070809/build-dbg/../i386/i386/fpu.c:814
0x134a55
interrupt
/build/buildd/gnumach-1.3.99.dfsg.cvs20070809/build-dbg/../i386/i386at/interrupt.S:44

The registers are:

cs 0x8
ds 0x10
es 0x10
fs 0x10
gs 0x10
ss 0x10
eax 0xa
ecx 0x7dff4
edx 0x3d5
ebx 0xffffffff
esp 0x2ddff0
ebp 0x2de004
esi 0x1
edi 0x1204fc8
eip 0x117d06
efl 0x206

(esi and edi were different on a second time I triggered the panic)

This is the (trimmed down) program which provokes the panic:

--8<--
/* fpe-test.c */
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>

volatile int erl_fp_exception;

static void unmask_x87(void)
{
    unsigned short cw;
    __asm__ __volatile__("fstcw %0" : "=m"(cw));
    cw &= ~(0x01|0x04|0x08);   /* unmask IM, ZM, OM */
    __asm__ __volatile__("fldcw %0" : : "m"(cw));
}

static void unmask_fpe(void)
{
    unmask_x87();
}

static __inline__ int check_fpe(double f)
{
    __asm__ __volatile__("fwait" : "=m"(erl_fp_exception) : "m"(f));
    if (!erl_fp_exception)
       return 0;
    __asm__ __volatile__("fninit");
    unmask_fpe();
    return 1;
}

static void fpe_sig_handler(int sig)
{
    erl_fp_exception = 1;
}

static void do_init(void)
{
    signal(SIGFPE, fpe_sig_handler);
    unmask_fpe();
}

double a = 3.23e133;
double b = 3.57e257;
double res;

void do_fmul(void)
{
    res = a * b;
}

int do_check(void)
{
    if (check_fpe(res)) {
       fprintf(stderr, "res = %g, FPE worked\n", res);
       return 0;
    } else {
       fprintf(stderr, "res = %g, FPE failed\n", res);
       return 1;
}

int main(int argc, const char **argv)
{
    if (argc == 3) {
       a = atof(argv[1]);
       b = atof(argv[2]);
    }
    do_init();
    do_fmul();
    return do_check();
}
--8<--

It gets compiled with gcc -o erlang -g -O2
-I/org/buildd/build/buildd/erlang-11.b.5dfsg/erts/i686-unknown-gnu0.3
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -D_GNU_SOURCE   erlang.c
-lutil -ldl -lm.


Michael




Reply to: