From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] fp: stack underflow error Date: Thu, 1 Jul 2004 20:24:23 +0100 From: rog@vitanuova.com In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: b271edfe-eacd-11e9-9e20-41e7f4b1d025 > I encountered a "sys: fp: stack underflow" error in my program. looks like a compiler bug. here's a simpler version of the code that does the same thing. who'd've thought that a2b() would generate such convoluted code? what's that comparison for? TEXT a2b+0(SB),0,$12 MOVL tb+4(FP),CX SUBL fb+0(FP),CX MOVL CX,.safe+-4(SP) FMOVL .safe+-4(SP),F0 CMPL CX,$0 JGE ,2(PC) FADDD $(4.29496729600000000e+09),F0 FMULD dis+8(FP),F0 FSTCW ,.safe+-8(SP) MOVW $3967,.safe+-6(SP) FLDCW .safe+-6(SP), FMOVLP F0,.safe+-4(SP) FLDCW .safe+-8(SP), MOVL .safe+-4(SP),AX RET , #include #include int a2b(int fb, uint tb, double dis) { return (tb - fb)*dis; } void main(void) { a2b(1, 0, 65); a2b(1, 0, 66); }