Playing with acid a bit:
cpu% cat tnan.c
#include <u.h>
#include <libc.h>
void
main(int, char**)
{
NaN(); // ☹
exits(0);
}
cpu% 8c -FTVw tnan.c
cpu% 8l -o tnan tnan.8
cpu% tnan
tnan 55986: suicide: sys: fp: invalid operation fppc=0x108d status=0x8081
pc=0x00001028
cpu% acid -l acme 55986
/proc/55986/text:386 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/acme
/sys/lib/acid/386
acid: stk()
At pc:0x00001028:main+0x8 /usr/chesky/src/hak/lex/tnan.c:7
main()
called from _main+0x31 /sys/src/libc/386/main9.s:16
acid: regs()
PC 0x00001028 main+0x8 /usr/chesky/src/hak/lex/tnan.c:7
SP 0xdfffef5c ECODE 0xf0100661 EFLAG 0x00010292
CS 0x00000023 DS 0x0000001b SS 0x0000001b
GS 0xf010001b FS 0x0000001b ES 0x0000001b
TRAP 0x00000010 math coprocessor error
AX 0xdfffefb4 BX 0x00000001 CX 0x00000000 DX 0x0001d260
DI 0xdfffea17 SI 0x0001f425 BP 0x00031e00
acid: asm(main)
main 0x00001020 SUBL $0x8,SP
main+0x3 0x00001023 CALL NaN(SB)
main+0x8 0x00001028 FMOVDP F0,F0
main+0xa 0x0000102a MOVL $0x0,0x0(SP)
main+0x11 0x00001031 CALL exits(SB)
main+0x16 0x00001036 ADDL $0x8,SP
main+0x19 0x00001039 RET
_main 0x0000103a SUBL $0x48,SP
acid: fpr()
F0 0
F1 0
F2 0
F3 0
F4 0
F5 0
F6 3.431198e+09
F7 1000
control 0x027f
status 0x0001
tag 0xffff
ip offset 0x0000108d
cs selector 0x0023
opcode 0xea17
data operand offset 0xef50
operand selector 0x001b
acid: asm(NaN)
NaN 0x0000107a SUBL $0xc,SP
NaN+0x3 0x0000107d MOVL $0x7ff00000,0x8(SP)
NaN+0xb 0x00001085 MOVL $0x1,a+0x4(SP)
NaN+0x13 0x0000108d FMOVD a+0x4(SP),F0
NaN+0x17 0x00001091 ADDL $0xc,SP
NaN+0x1a 0x00001094 RET
isNaN 0x00001095 SUBL $0x1c,SP
acid:
Considering that fppc points into NaN (0x108d), is the suicide
happening within NaN? Anything I can do to pinpoint the bug better?
--Joel