Skip to content

Commit 970b00f

Browse files
committed
fix(parform): broadcast redefined variables after each expression
Redefined variables must be broadcast after processing each expression. Otherwise, the information collected in AC.inputnumbers is wiped out at the beginning of processing the next expression. This fixes #525.
1 parent ddb040c commit 970b00f

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

check/fixes.frm

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,6 +2841,23 @@ print;
28412841
assert succeeded?
28422842
assert result("F") =~ expr("5000")
28432843
*--#] Issue508 :
2844+
*--#[ Issue525 :
2845+
#:threadbucketsize 5
2846+
#:processbucketsize 5
2847+
S x;
2848+
L F = (1-x)^100;
2849+
L F1 = 1;
2850+
L F2 = 1;
2851+
.sort
2852+
#define x "0"
2853+
if (expression(F1)) redefine x "1";
2854+
.sort
2855+
id x = `x';
2856+
P F;
2857+
.end
2858+
assert succeeded?
2859+
assert result("F") =~ expr("0")
2860+
*--#] Issue525 :
28442861
*--#[ Issue563 :
28452862
#: SubTermsInSmall 50
28462863

sources/execute.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -860,11 +860,6 @@ WORD DoExecute(WORD par, WORD skip)
860860
RetCode = PF_BroadcastModifiedDollars();
861861
if ( RetCode ) return RetCode;
862862
}
863-
/* Broadcast redefined preprocessor variables. */
864-
if ( AC.numpfirstnum > 0 ) {
865-
RetCode = PF_BroadcastRedefinedPreVars();
866-
if ( RetCode ) return RetCode;
867-
}
868863
/* Broadcast the list of objects converted to symbols in AM.sbufnum. */
869864
if ( AC.topolynomialflag & TOPOLYNOMIALFLAG ) {
870865
RetCode = PF_BroadcastCBuf(AM.sbufnum);

sources/parallel.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,11 @@ int PF_Processor(EXPRESSIONS e, WORD i, WORD LastExpression)
17681768
/* Now handle redefined preprocessor variables. */
17691769
if ( AC.numpfirstnum > 0 ) PF_UnpackRedefinedPreVars();
17701770
}
1771+
/* Broadcast redefined preprocessor variables. */
1772+
if ( AC.numpfirstnum > 0 ) {
1773+
int RetCode = PF_BroadcastRedefinedPreVars();
1774+
if ( RetCode ) return RetCode;
1775+
}
17711776
if ( ! AC.OldParallelStats ) {
17721777
/* Now we can calculate AT.SS->GenTerms from the statistics of the slaves. */
17731778
LONG genterms = 0;
@@ -1917,6 +1922,11 @@ int PF_Processor(EXPRESSIONS e, WORD i, WORD LastExpression)
19171922
/* Now handle redefined preprocessor variables. */
19181923
if ( AC.numpfirstnum > 0 ) PF_PackRedefinedPreVars();
19191924
PF_LongSingleSend(MASTER, PF_ENDSORT_MSGTAG);
1925+
/* Broadcast redefined preprocessor variables. */
1926+
if ( AC.numpfirstnum > 0 ) {
1927+
int RetCode = PF_BroadcastRedefinedPreVars();
1928+
if ( RetCode ) return RetCode;
1929+
}
19201930
/*
19211931
#] Collect (stats,prepro...) :
19221932

0 commit comments

Comments
 (0)