9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: YAMANASHI Takeshi <uncover@beat.cc.titech.ac.jp>
To: 9fans@cse.psu.edu
Subject: [9fans] fp: stack underflow error
Date: Thu,  1 Jul 2004 13:50:35 +0900	[thread overview]
Message-ID: <b974470c3e357a7efd16b8345fb68e94@orthanc.cc.titech.ac.jp> (raw)

I encountered a "sys: fp: stack underflow" error in my program.
When I change the uint arguments of a2b() to int, the modified program
ran successfully.  What's wrong with my program?

Thanks in advance.

++ program and acid stack trace are attached below ++

% nashi@valinore cat suflow.c
#include <u.h>
#include <libc.h>

/*{
	8c suflow.c; 8l suflow.8; ./8.out
}*/

ulong
a2b(uint fr, uint fg, uint fb, uint tr, uint tg, uint tb, double dis)
{
	uchar r, g, b;

	r = fr + (tr - fr)*dis;
	g = fg + (tg - fg)*dis;
	b = fb + (tb - fb)*dis;

	return (r<<24)+(g<<16)+(b<<8)+0xFF;
}

void
main()
{
	int i;
	ulong p;

	for(i=0; i<256; i++)
		p=a2b(0, 0, 0xFF, 00, 0xFF, 00, 2.0*i/256.0);
	exits(nil);
}



% nashi@valinore ./8.out
8.out 1167: suicide: sys: fp: stack underflow fppc=0x1118 status=0x80a1 pc=0x0000118f


% nashi@valinore acid 1167
/proc/1167/text:386 plan 9 executable

/sys/lib/acid/port
/sys/lib/acid/386
acid: stk()
At pc:0x0000118f:main+0x46 /usr/nashi/src/test/suflow.c:27
main() /usr/nashi/src/test/suflow.c:21
	called from _main+0x31 /sys/src/libc/386/main9.s:16

--




             reply	other threads:[~2004-07-01  4:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-01  4:50 YAMANASHI Takeshi [this message]
2004-07-01  8:55 ` Kenji Okamoto
2004-07-01 19:24 ` rog
2004-07-01 20:32   ` Charles Forsyth
2004-07-01 20:38     ` boyd, rounin
2004-07-02  9:34   ` Charles Forsyth
2004-07-02 10:25     ` Geoff Collyer
2004-07-02 10:53       ` Charles Forsyth
2004-07-02  0:35 YAMANASHI Takeshi
2004-07-02  1:02 ` Kenji Okamoto
2004-07-02  1:04   ` Kenji Okamoto
2004-07-02  1:05     ` Kenji Okamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b974470c3e357a7efd16b8345fb68e94@orthanc.cc.titech.ac.jp \
    --to=uncover@beat.cc.titech.ac.jp \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).