From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C79B9B.D204472A" Date: Mon, 21 May 2007 13:32:45 +0200 Message-ID: From: To: <9fans@cse.psu.edu> Subject: [9fans] debugging help asked for Topicbox-Message-UUID: 6c51503a-ead2-11e9-9d60-3106f5b1d025 This is a multi-part message in MIME format. ------_=_NextPart_001_01C79B9B.D204472A Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Dear folks! =20 I compiled successfully a code ported from gcc/linux that runs OK there. = However, I'm getting stack underflow error when running it under Plan 9. The code is here: =20 http://www.gli.cas.cz/home/cejchan/plan9/pathd8.tgz =20 to run: =20 pathd8 infile outfile =20 Any hints much appreciated!! I cant't see why zeros are read in within = the second cycle [see print()] Thanks, regards, =20 ++pac. =20 ------_=_NextPart_001_01C79B9B.D204472A Content-Type: text/html; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable

Dear folks!

 

I compiled successfully a code ported from = gcc/linux that runs OK there. However, I’m getting stack underflow error = when running it under Plan 9.

The code is here:

 

http://www.g= li.cas.cz/home/cejchan/plan9/pathd8.tgz

 

to run:

 

pathd8 infile = outfile

 

Any hints much appreciated!! I cant’t = see why zeros are read in within the second cycle [see = print()]

Thanks, regards,

 

++pac.

 

------_=_NextPart_001_01C79B9B.D204472A-- From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4afbc685a37beabd845c2022ecf4bbf7@hamnavoe.com> To: 9fans@cse.psu.edu Subject: Re: [9fans] debugging help asked for From: Richard Miller <9fans@hamnavoe.com> Date: Mon, 21 May 2007 14:36:09 +0100 In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 6c629fc0-ead2-11e9-9d60-3106f5b1d025 You're dividing by zero in pathd8/mpl.c: subtree_var[i] = n->child[i]->var + n->edge_len[i]; ... p_bar_numerator += subtree_est[i]/subtree_var[i]; because the terminal node 'Frog' has var and edge_len both equal to zero. Possibly gcc/linux reacts differently to division by zero? From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <49816f71a7fa67a70669172ba3195886@terzarima.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] debugging help asked for From: Charles Forsyth Date: Tue, 22 May 2007 11:43:41 +0100 In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 6f1fd3d6-ead2-11e9-9d60-3106f5b1d025 > I compiled successfully a code ported from gcc/linux that runs OK there. However, I'm getting stack underflow error when running it under Plan 9. that often happens when a function that returns double has no external declaration in scope where it's used, and it gets the default type of int, so the result on the floating-point stack is not popped at the point of call. that applies even when it's called for side-effect. double f(int); void g(void) { f(3); } h% 8c -S db.c TEXT g+0(SB),0,$8 MOVL $3,AX MOVL AX,(SP) CALL ,f+0(SB) FMOVDP F0,F0 RET , END , note the P (pop) suffix on FMOVDP of course, the compiler will have complained about the missing declaration unless you've told it otherwise. From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <9e6e4ac20cc7b2bdad26436c68e9c507@terzarima.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] debugging help asked for From: Charles Forsyth Date: Tue, 22 May 2007 11:45:41 +0100 In-Reply-To: <49816f71a7fa67a70669172ba3195886@terzarima.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 6f2d718a-ead2-11e9-9d60-3106f5b1d025 >> I compiled successfully a code ported from gcc/linux that runs OK there. However, I'm getting stack underflow error when running it under Plan 9. > > that often happens when a function that returns double has no external declaration in scope where it's used, hang on: perhaps that only causes stack overflow. oh well, now you know not to do it in any case. From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <8fdfc0df76e12f4f3e0a58368e2a816b@terzarima.net> To: 9fans@cse.psu.edu Subject: Re: [9fans] debugging help asked for From: Charles Forsyth Date: Tue, 22 May 2007 12:03:29 +0100 In-Reply-To: <9e6e4ac20cc7b2bdad26436c68e9c507@terzarima.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: 6f47483a-ead2-11e9-9d60-3106f5b1d025 >> that often happens when a function that returns double has no external declaration in scope where it's used, > > hang on: perhaps that only causes stack overflow. oh well, now you know not to do it in any case. i've checked now: that case does give stack overflow. stack underflow will result if you declare a function as returning double in the caller, but it doesn't actually do that, perhaps it's void or int.