Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions check/fixes.frm
Original file line number Diff line number Diff line change
Expand Up @@ -2119,6 +2119,29 @@ P;
#pend_if mpi?
assert runtime_error?
*--#] Issue261_7 :
*--#[ Issue268_1 :
* Invalid read in Normalize
#define N "9999"
CF f;
S x1,x2;
L F = f(1,...,`N');
id f(x1?,?a,x2?) = f(?a);
id f(?a,x2?) = x2+1;
P;
.end
assert succeeded?
assert result("F") =~ expr("9999")
*--#] Issue268_1 :
*--#[ Issue268_2 :
#define N "9999"
CF f;
L F = f(1,...,`N');
id f(?a) = nargs_(?a);
P;
.end
assert succeeded?
assert result("F") =~ expr("9999")
*--#] Issue268_2 :
*--#[ Issue277 :
* A question about addargs
CFunction f,g,h;
Expand Down
5 changes: 4 additions & 1 deletion sources/ftypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,10 @@ typedef int (*TFUN1)();
#define NUMTOSYM 21
#define NUMTOIND 22
#define NUMTOSUB 23
/*
Flag or-ed with ARGTOARG to give the number of arguments.
*/
#define EATTENSOR 0x2000

/*
Dirty flags (introduced when functions got a field with a dirty flag)
Expand Down Expand Up @@ -779,7 +783,6 @@ typedef int (*TFUN1)();
#define RATIONALMODE 0

#define NUMSPECSETS 10
#define EATTENSOR 0x2000

#define ISZERO 1
#define ISUNMODIFIED 2
Expand Down
3 changes: 1 addition & 2 deletions sources/function.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,8 +1052,7 @@ FullOK: if ( AN.SignCheck && AN.ExpectedSign ) goto NoGamma;
AN.argaddress = t;
if ( *m == FUNNYWILD ) {
tobeeaten = AT.WildArgTaken[numofwildarg++];
i = tobeeaten | EATTENSOR;
if ( CheckWild(BHEAD m[1],ARGTOARG,i,t) ) goto endloop;
if ( CheckWild(BHEAD m[1],ARGTOARG|EATTENSOR,tobeeaten,t) ) goto endloop;
AddWild(BHEAD m[1],ARGTOARG,i);
m += 2;
t += tobeeaten;
Expand Down
8 changes: 4 additions & 4 deletions sources/symmetr.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,8 @@ int MatchCy(PHEAD WORD *pattern, WORD *fun, WORD *inter, WORD par)
if ( *p == FUNNYWILD ) {
p++; wc = 1;
AN.argaddress = t;
if ( CheckWild(BHEAD *p,ARGTOARG,funnycount|EATTENSOR,t) ) break;
AddWild(BHEAD *p,ARGTOARG,funnycount|EATTENSOR);
if ( CheckWild(BHEAD *p,ARGTOARG|EATTENSOR,funnycount,t) ) break;
AddWild(BHEAD *p,ARGTOARG|EATTENSOR,funnycount);
j += funnycount-1; t += funnycount-1;
}
else if ( *p >= AM.OffsetIndex + WILDOFFSET
Expand Down Expand Up @@ -957,8 +957,8 @@ int MatchCy(PHEAD WORD *pattern, WORD *fun, WORD *inter, WORD par)
if ( *p == FUNNYWILD ) {
p++; wc = thewildcards[renum[*p]];
AN.argaddress = t;
if ( CheckWild(BHEAD *p,ARGTOARG,wc|EATTENSOR,t) ) break;
AddWild(BHEAD *p,ARGTOARG,wc|EATTENSOR);
if ( CheckWild(BHEAD *p,ARGTOARG|EATTENSOR,wc,t) ) break;
AddWild(BHEAD *p,ARGTOARG|EATTENSOR,wc);
j += wc-1; t += wc-1; wc = 1;
}
else if ( *p >= AM.OffsetIndex + WILDOFFSET
Expand Down
12 changes: 8 additions & 4 deletions sources/wildcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,8 @@ WORD AddWild(PHEAD WORD oldnumber, WORD type, WORD newnumber)
GETBIDENTITY
WORD *w, *m, n, k, i = -1;
CBUF *C = cbuf+AT.ebufnum;
WORD eattensor = type & EATTENSOR;
type = type & ~EATTENSOR;
DEBUG(WORD *mm;)
AN.WildReserve = 0;
m = AT.WildMask;
Expand Down Expand Up @@ -1560,8 +1562,8 @@ DEBUG(MesPrint("Thread %w(d): m=(%d,%d,%d,%d)(%d)",mm[0],mm[1],mm[2],mm[3],C->nu
w[3] = C->numrhs;
w = AN.argaddress;
DEBUG(mm=m;)
if ( ( newnumber & EATTENSOR ) != 0 ) {
n = newnumber & ~EATTENSOR;
if ( eattensor ) {
n = newnumber;
*m++ = n;
w = AN.argaddress;
}
Expand Down Expand Up @@ -1764,6 +1766,8 @@ WORD CheckWild(PHEAD WORD oldnumber, WORD type, WORD newnumber, WORD *newval)
WORD *w, *m, *s, n, old2, inset;
WORD n2, oldval, dirty, i, j, notflag = 0, retblock = 0;
CBUF *C = cbuf+AT.ebufnum;
WORD eattensor = type & EATTENSOR;
type = type & ~EATTENSOR;
m = AT.WildMask;
w = AN.WildValue;
n = AN.NumWild;
Expand Down Expand Up @@ -1867,8 +1871,8 @@ WORD CheckWild(PHEAD WORD oldnumber, WORD type, WORD newnumber, WORD *newval)
if ( w[2] == oldnumber && *w == ARGTOARG ) {
if ( !*m ) return(0); /* nihil obstat */
m = C->rhs[w[3]];
if ( ( newnumber & EATTENSOR ) != 0 ) {
n = newnumber & ~EATTENSOR;
if ( eattensor ) {
n = newnumber;
if ( *m != 0 ) {
if ( n == *m ) {
m++;
Expand Down