id = 2078 title = "Qemu crashes with SIGFPE on certain trapping arithmetic operations on m68k target" state = "opened" created_at = "2024-01-07T17:26:27.825Z" closed_at = "n/a" labels = ["accel: TCG", "target: m68k"] url = "https://gitlab.com/qemu-project/qemu/-/issues/2078" host-os = "NetBSD" host-arch = "x86-64" qemu-version = "QEMU emulator version 8.1.3" guest-os = "NetBSD" guest-arch = "m68k" description = """I recently ported NetBSD to the Qemu m68k "virt" platform, and this was discovered when running NetBSD's automated tests. Certain arithmetic operation that will trap in the guest will crash Qemu. First case encountered is below.""" reproduce = """1. Compile and run the following program in the m68k guest: ``` virt68k:thorpej 3$ cat crash-qemu.c #include #include int divisor = -1; int main(int argc, char *argv[]) { \tif (argc > 1) \t\tdivisor = atoi(argv[1]); \treturn INT_MIN / divisor; } virt68k:thorpej 4$ ``` Another minimal case would be: ``` move.l #-2147483648,%d0 move.l #-1,%d1 divsl.l %d1,%d1:%d0 ```""" additional = """"""