9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] 'fp: stack overflow'
@ 2004-03-04 18:25 David Tolpin
  2004-03-04 18:33 ` David Presotto
  2004-03-04 22:21 ` boyd, rounin
  0 siblings, 2 replies; 8+ messages in thread
From: David Tolpin @ 2004-03-04 18:25 UTC (permalink / raw)
  To: 9fans


Hi,

I am getting 'fp: stack overfow' on a pretty simple code from graphviz
building Bezier curves. The code literally just computes a mean of two
numbers t=(high+low)/2.0 , and when t is about to become 0.9375, it
dies with fp: stack overflow. Of course, it is not reproducable on simpler
tests.

Any thoughts?

David


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

* Re: [9fans] 'fp: stack overflow'
  2004-03-04 18:25 [9fans] 'fp: stack overflow' David Tolpin
@ 2004-03-04 18:33 ` David Presotto
  2004-03-04 18:35   ` David Tolpin
  2004-03-04 22:21 ` boyd, rounin
  1 sibling, 1 reply; 8+ messages in thread
From: David Presotto @ 2004-03-04 18:33 UTC (permalink / raw)
  To: 9fans

Are you using notes that might be interrupting in the middle of a
floating point expression and then doing more floating point in the
note handler?  Other than that, it just sounds like a bug.  Staring
at the assembly language (acid it and asm() the routine) would
probably tell you what's wrong.


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

* Re: [9fans] 'fp: stack overflow'
  2004-03-04 18:33 ` David Presotto
@ 2004-03-04 18:35   ` David Tolpin
  2004-03-04 18:39     ` Charles Forsyth
  2004-03-04 18:40     ` David Presotto
  0 siblings, 2 replies; 8+ messages in thread
From: David Tolpin @ 2004-03-04 18:35 UTC (permalink / raw)
  To: 9fans

> Are you using notes that might be interrupting in the middle of a
> floating point expression and then doing more floating point in the
> note handler?  Other than that, it just sounds like a bug.  Staring
> at the assembly language (acid it and asm() the routine) would
> probably tell you what's wrong.

It's a working code from graphviz, used on many platforms; the rest
works (that is, I can just comment this part out and get a graph
with straight lines instead of splines), and the floating point
numbers are only introduced inside the function.

I'll try to debug the assembly code.


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

* Re: [9fans] 'fp: stack overflow'
  2004-03-04 18:35   ` David Tolpin
@ 2004-03-04 18:39     ` Charles Forsyth
  2004-03-04 20:22       ` David Tolpin
  2004-03-04 18:40     ` David Presotto
  1 sibling, 1 reply; 8+ messages in thread
From: Charles Forsyth @ 2004-03-04 18:39 UTC (permalink / raw)
  To: 9fans

the compiler might be miscalculating the depth of the FP
stack, allowing it to overflow at run-time.
(alternatively, it might just be missing a pop variant in a particular case.)
either way it would be helpful to see if you can isolate the expression(s)
that cause the trouble.



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

* Re: [9fans] 'fp: stack overflow'
  2004-03-04 18:35   ` David Tolpin
  2004-03-04 18:39     ` Charles Forsyth
@ 2004-03-04 18:40     ` David Presotto
  1 sibling, 0 replies; 8+ messages in thread
From: David Presotto @ 2004-03-04 18:40 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 65 bytes --]

When I said bug, I meant in our compiler not the graphviz code...

[-- Attachment #2: Type: message/rfc822, Size: 2685 bytes --]

From: David Tolpin <dvd@davidashen.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] 'fp: stack overflow'
Date: Thu, 4 Mar 2004 22:35:25 +0400 (AMT)
Message-ID: <200403041835.i24IZPTZ058629@adat.davidashen.net>

> Are you using notes that might be interrupting in the middle of a
> floating point expression and then doing more floating point in the
> note handler?  Other than that, it just sounds like a bug.  Staring
> at the assembly language (acid it and asm() the routine) would
> probably tell you what's wrong.

It's a working code from graphviz, used on many platforms; the rest
works (that is, I can just comment this part out and get a graph
with straight lines instead of splines), and the floating point
numbers are only introduced inside the function.

I'll try to debug the assembly code.

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

* Re: [9fans] 'fp: stack overflow'
  2004-03-04 18:39     ` Charles Forsyth
@ 2004-03-04 20:22       ` David Tolpin
  2004-03-04 20:30         ` David Tolpin
  0 siblings, 1 reply; 8+ messages in thread
From: David Tolpin @ 2004-03-04 20:22 UTC (permalink / raw)
  To: 9fans

>
> the compiler might be miscalculating the depth of the FP
> stack, allowing it to overflow at run-time.
> (alternatively, it might just be missing a pop variant in a particular case.)
> either way it would be helpful to see if you can isolate the expression(s)
> that cause the trouble.
>

The trouble is moving all around the floating point code if I am trying
to isolate it. The expressions are moderately complex, such as

  Vtemp[i][j].x = (1.0 - t) * Vtemp[i-1][j].x + t * Vtemp[i-1][j+1].x

but the problem moves to another expression in another function or
another part of the library (or just to a later invocation of the same
function) if I simpify them.

I must admit that I do not remember the x86 assembler well enough
to debug. But it looks to me like FP stack is unbalanced, and 
gets overflowed due to missing pops (or are they called folds?)

David


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

* Re: [9fans] 'fp: stack overflow'
  2004-03-04 20:22       ` David Tolpin
@ 2004-03-04 20:30         ` David Tolpin
  0 siblings, 0 replies; 8+ messages in thread
From: David Tolpin @ 2004-03-04 20:30 UTC (permalink / raw)
  To: 9fans

I am getting stack overflow on eigth call to Bezier on any input file.
I'm recalling that there are eight FP registers, so if it is off by one
in the FP code generator, then it should be filled in eight calls.

However, my knowledge of the assembler is very bad, and to actually find
where one register is lost I will have to re-learn it. 

If anyone is willing to help me, I am ready to provide all I have.

David


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

* Re: [9fans] 'fp: stack overflow'
  2004-03-04 18:25 [9fans] 'fp: stack overflow' David Tolpin
  2004-03-04 18:33 ` David Presotto
@ 2004-03-04 22:21 ` boyd, rounin
  1 sibling, 0 replies; 8+ messages in thread
From: boyd, rounin @ 2004-03-04 22:21 UTC (permalink / raw)
  To: 9fans

> Any thoughts?

diddums



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

end of thread, other threads:[~2004-03-04 22:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-04 18:25 [9fans] 'fp: stack overflow' David Tolpin
2004-03-04 18:33 ` David Presotto
2004-03-04 18:35   ` David Tolpin
2004-03-04 18:39     ` Charles Forsyth
2004-03-04 20:22       ` David Tolpin
2004-03-04 20:30         ` David Tolpin
2004-03-04 18:40     ` David Presotto
2004-03-04 22:21 ` boyd, rounin

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