9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] fp: stack underflow error
@ 2004-07-02  0:35 YAMANASHI Takeshi
  2004-07-02  1:02 ` Kenji Okamoto
  0 siblings, 1 reply; 12+ messages in thread
From: YAMANASHI Takeshi @ 2004-07-02  0:35 UTC (permalink / raw)
  To: 9fans

> Probably, you see some comment in a ghostscript program
> gshtscr.c by Russ (ssearch RSC string).   Because now Russ is out.

Sorry.  I couldn't find the comment in /sys/src/cmd/gs/src/gshtscr.c.
I fetched it from sources.  Had I looked into wrong one?

If it is a compiler bug as Rog and Forsyth mentioned in other mail,
I will walk around it by using int-typed arguments for the present
and sleep soundly tonight.

Thank you,
--
Sincerely,
YAMANASHI Takeshi




^ permalink raw reply	[flat|nested] 12+ messages in thread
* [9fans] fp: stack underflow error
@ 2004-07-01  4:50 YAMANASHI Takeshi
  2004-07-01  8:55 ` Kenji Okamoto
  2004-07-01 19:24 ` rog
  0 siblings, 2 replies; 12+ messages in thread
From: YAMANASHI Takeshi @ 2004-07-01  4:50 UTC (permalink / raw)
  To: 9fans

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

--




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-07-02 10:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-02  0:35 [9fans] fp: stack underflow error YAMANASHI Takeshi
2004-07-02  1:02 ` Kenji Okamoto
2004-07-02  1:04   ` Kenji Okamoto
2004-07-02  1:05     ` Kenji Okamoto
  -- strict thread matches above, loose matches on Subject: below --
2004-07-01  4:50 YAMANASHI Takeshi
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

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).