Thread View: comp.bugs.misc
2 messages
2 total messages
Started by randall
Fri, 02 Oct 1987 22:34
Bug in dc?
Author: randall
Date: Fri, 02 Oct 1987 22:34
Date: Fri, 02 Oct 1987 22:34
34 lines
1742 bytes
1742 bytes
Running the short dc routine below to find the gcd of two numbers appears to work for small numbers. The command line is: %dc gcd r & s are passing parameters, returned in lowest terms initiate by: l7x ====================================================== [lx_1*sx]s1[ly_1*sy]s2[lyszlxsylzsx]s3[1sz]s4 [lxly%szlysxlzsy1lz>5lz0=6lz1=4]s5[lxsz]s6 [lrsxlssylx0>1ly0>2lxly>3l5xlrlz/srlslz/ss]s7 ?sr?ssl7x [r,s in lowest terms:]Pc [r= ]Plrpc [s= ]Plspc q ====================================================== When r & s are about 100 digits or so in length, an error message appears: %Segmentation fault (core dumped) What is wrong? Is the stack being recursively called until it overflows? I see nothing wrong in the subroutine above. Can anyone find out what is the problem and let me know? (e-mail is preferable) Is this a bug in dc? I am working with rational points on cubic surfaces, and need to have this problem fixed, to investigate the action of the chord-tangent process on creating new E(Q) pairs of the infinite birational pairs group. reply to: Randall.Rathbun@thor.SanDiego.NCR.COM or randall@thor.sandiego.NCR.COM thanks sincerely - Randall
Re: Bug in dc? and another one?
Author: Mike Wescott
Date: Wed, 07 Oct 1987 19:40
Date: Wed, 07 Oct 1987 19:40
40 lines
1775 bytes
1775 bytes
In article <1800@ncr-sd.SanDiego.NCR.COM> randall@ncr-sd.SanDiego.NCR.COM (0000-Randall Rathbun) writes:
> Running the short dc routine below to find the gcd of two numbers
> appears to work for small numbers.
>
> ........
>
> When r & s are about 100 digits or so in length, an error message appears:
> %Segmentation fault (core dumped)
>
> What is wrong?
Looks like an overflow of readstk. readstk has a hard coded limit of 100
in the SysVr3 source that I have access to. It's a bug in that the exceeding
the limit is not gracefully handled.
While tracking down this problem I came across some strange looking code:
In readc():
if((readptr != &readstk[0]) && (*readptr != 0)){
.
.
.
}
.
.
if(readptr != &readptr[0]){ <===== ???????????
readptr--;
.
.
.
Surely the author meant "if(readptr != &readstk[0]) ...
In anycase the whole if stmt gets optimized to nothing. Looks like the
relics of an attempt to put a more general file reading mechanism into dc.
-Mike Wescott
--
-Mike Wescott
wescott@ncrcae.Columbia.NCR.COM
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads