Compare commits

..

3 Commits

Author SHA1 Message Date
Landon Curt Noll
160f4102ab Release calc version 2.11.0t10.2 2017-05-21 15:38:34 -07:00
Landon Curt Noll
306e031f03 Release calc version 2.11.0t10.1.4 2017-05-21 15:38:34 -07:00
Landon Curt Noll
6cfe9696ce Release calc version 2.11.0t10.1.3 2017-05-21 15:38:34 -07:00
8 changed files with 27 additions and 117 deletions

View File

@@ -19,6 +19,13 @@ The following are the changes from calc version 2.11.0t10 to date:
The 'unused value ignored' messages now start with Line 999: instead
of just 999:.
Fixed some typos in the help files as reported by Klaus Alexander
Seistrup <klaus@seistrup.dk>.
Fixed the long standing issue first reported by Saber-C in the
domul() function in zmil.c thanks to a patch by Ernest Bowen
<ernie@turing.une.edu.au>.
The following are the changes from calc version 2.11.0t8.9.1 to 2.11.0t9.4.5:

View File

@@ -1114,8 +1114,7 @@ custom.o: custom.c ${MAKE_FILE}
${CC} ${CFLAGS} ${ALLOW_CUSTOM} -c custom.c
hist.o: hist.c ${MAKE_FILE}
${CC} ${CFLAGS} ${TERMCONTROL} ${USE_READLINE} ${READLINE_INCLUDE} \
-c hist.c
${CC} ${CFLAGS} ${TERMCONTROL} ${USE_READLINE} ${READLINE_INCLUDE} -c hist.c
func.o: func.c ${MAKE_FILE}
${CC} ${CFLAGS} ${ALLOW_CUSTOM} -c func.c

View File

@@ -22,7 +22,7 @@ EXAMPLE
"chongo was here"
LIMITS
fd must be associaed with an open file
fd must be associated with an open file
LIBRARY
none

View File

@@ -159,9 +159,9 @@ define mod_inv(a)
define mod_div(a, b)
{
local c, x, y;
obj mod x, y;
local c;
local obj mod x;
local obj mod y;
if (isnum(a))
a = lmod(a);
if (isnum(b))

View File

@@ -471,8 +471,9 @@ define plist(s) {
define deg(a) = size(a.p) - 1;
define polydiv(a,b) {
local q, r, d, u, i, m, n, sa, sb, sq;
obj poly q, r;
local d, u, i, m, n, sa, sb, sq;
local obj poly q;
local obj poly r;
sa=findlist(a); sb = findlist(b); sq = list();
m=size(sa)-1; n=size(sb)-1;
if (n<0) quit "Zero divisor";

View File

@@ -3048,8 +3048,8 @@ define test_error()
print '3712: e9999 = error(9999)';
vrfy(errno() == 9999, '3713: errno() == 9999');
vrfy(error() == e9999, '3714: error() == e9999');
vrfy(substr(strerror(), strlen(strerror())-3, 4) == "9999",
'3715: substr(strerror(), strlen(strerror())-3, 4) == "9999"');
vrfy(substr(strerror(), strpos(strerror(),"9999"), 4) == "9999",
'3715: substr(strerror(), strpos(strerror(),"9999"), 4) == "9999"');
x = newerror("Alpha");
print '3716: x = newerror("Alpha")';
n = iserror(x);
@@ -3060,19 +3060,21 @@ define test_error()
vrfy(errno(9999) == n, '3721: errno() == n');
vrfy(errno() == 9999, '3722: errno() == 9999');
vrfy(error() == e9999, '3723: error() == e9999');
vrfy(substr(strerror(), strlen(strerror())-3, 4) == "9999",
'3724: substr(strerror(), strlen(strerror())-3, 4) == "9999"');
vrfy(substr(strerror(), strpos(strerror(),"9999"), 4) == "9999",
'3724: substr(strerror(), strpos(strerror(),"9999"), 4) == "9999"');
a = 1/0;
print '3725: a = 1/0';
vrfy(strerror() == "Division by zero",
'3726: strerror() == "Division by zero"');
vrfy(substr(strerror(9941), strlen(strerror(9941))-3, 4) == "9941",
'3728: substr(strerror(9941), strlen(strerror(9941))-3, 4) == "9941"');
n = 8191;
print '3727: n = 8191';
vrfy(substr(strerror(8191),strpos(strerror(n),"8191"), 4) == "8191",
'3728: substr(strerror(n),strpos(strerror(n),"8191"),4) == "8191"');
/* errmax and errcount should be bumped up the 148 errors above */
vrfy(errcount() == ecnt, '3728: errcount() == ecnt');
vrfy(errcount() == ecnt, '3729: errcount() == ecnt');
print '3729: Ending test_error';
print '3730: Ending test_error';
}
print '054: parsed test_error()';

View File

@@ -18,7 +18,7 @@ static char *program;
#define MAJOR_VER 2 /* major version */
#define MINOR_VER 11 /* minor version */
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */
#define MINOR_PATCH "10.1.2" /* test number or empty string if no patch */
#define MINOR_PATCH "10.2" /* test number or empty string if no patch */
/*
* calc version constants

101
zmul.c
View File

@@ -279,106 +279,7 @@ domul(HALF *v1, LEN size1, HALF *v2, LEN size2, HALF *ans)
*/
baseA = v1 + shift;
baseB = v1;
/*
* XXX - is this still an issue?
*
* Saber-C Version 3.1 says:
*
* W#26, Storing a bad pointer into auto variable dmul`baseC.
*
* This warning is issued during the regression test #026
* (read cryrand).
*
* Saver-C claims that v2+shift is past the end of allocated
* memory for v2.
*
* This warning may be triggered by executing the following code:
*
* a = 0xffff0000ffffffff00000000ffff0000000000000000ffff;
* config("mul2", 2);
* pmod(3,a-1,a);
*
* [[ NOTE: The above code no longer invokes this code. ]]
*
* When this code is executed, shift == 6 and v2 is 3 shorts
* long (size2 == 2). This baseC points 3 shorts beyond the
* allocated end of v2.
*
* The stack was as follows: [[NOTE: line numbers may have changed]]
*
* domul(v1=0x2d93d8, size1=12,
* v2=0x2ded30, size2=2, ans=0x2ee8a8) at "zmul.c":313
* zmul(z1=0x2ee928, z2=0x2ee92c, res=0x16d8c0) at "zmul.c":73
* zpowermod(z1=0x2ee828, z2=0x2ee82c,
* z3=0x2ee830, res=0x57bfe4) at "zmod.c":666
* qpowermod(q1=0x57bf90, q2=0x57bfc8, q3=0x57bf3c) at "qfunc.c":78
* builtinfunc(...) at "func.c":400
* o_call(...) at "opcodes.c":2094
* calculate(...) at "opcodes.c":288
* evaluate(...) at "codegen.c":170
* getcommands(...) at "codegen.c":109
* main(...) at "calc.c":167
*
* The final domul() call point is the next executable line below.
*
****
*
* The insure tool also reports a problem at this position:
*
* [zmul.c:319] **COPY_BAD_RANGE**
* >> baseC = v2 + shift;
*
* Copying pointer which is out-of-range: v2 + shift
*
* [[NOTE: line numbers may have changed]]
*
* Pointer : 0x1400919cc
* Actual block : 0x140090c80 thru 0x140090def (368 bytes,92 elements)
* hp, allocated at:
* malloc()
* alloc() zmath.c, 221
* zmul() zmul.c, 73
* ztenpow() zfunc.c, 441
* str2q() qio.c, 537
* addnumber() const.c, 52
* eatnumber() token.c, 594
* gettoken() token.c, 319
* getcallargs() codegen.c, 2358
*
* Stack trace where the error occurred:
* domul() zmul.c, 319
* zmul() zmul.c, 74
* ztenpow() zfunc.c, 441
* str2q() qio.c, 537
* addnumber() const.c, 52
* eatnumber() token.c, 594
* gettoken() token.c, 319
* getcallargs() codegen.c, 2358
* getidexpr() codegen.c, 1998
* getterm() codegen.c, 1936
* getincdecexpr() codegen.c, 1820
* getreference() codegen.c, 1804
* getshiftexpr() codegen.c, 1758
* getandexpr() codegen.c, 1704
* getorexpr() codegen.c, 1682
* getproduct() codegen.c, 1654
* getsum() codegen.c, 1626
* getrelation() codegen.c, 1585
* getandcond() codegen.c, 1556
* getorcond() codegen.c, 1532
* getaltcond() codegen.c, 1499
* getassignment() codegen.c, 1442
* getopassignment() codegen.c, 1352
* getexprlist() codegen.c, 1318
* getstatement() codegen.c, 921
* evaluate() codegen.c, 219
* getcommands() codegen.c, 165
* main() calc.c, 321
*
* The final domul() call point is the next executable line below.
*/
/* ok to ignore on name domul`baseC */
baseC = v2 + shift;
baseC = v2 + ((shift <= size2) ? shift : size2);
baseD = v2;
baseAB = ans;
baseDC = ans + shift;