From 27952a1cf21fea0248c450ff2ae31516824f74c6 Mon Sep 17 00:00:00 2001 From: Takahiro Ueda Date: Tue, 28 May 2024 12:37:15 +0900 Subject: [PATCH] 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. --- check/fixes.frm | 17 +++++++++++++++++ sources/execute.c | 5 ----- sources/parallel.c | 10 ++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/check/fixes.frm b/check/fixes.frm index ef4112c1..b14265fc 100644 --- a/check/fixes.frm +++ b/check/fixes.frm @@ -2841,6 +2841,23 @@ print; assert succeeded? assert result("F") =~ expr("5000") *--#] Issue508 : +*--#[ Issue525 : +#:threadbucketsize 5 +#:processbucketsize 5 +S x; +L F = (1-x)^100; +L F1 = 1; +L F2 = 1; +.sort +#define x "0" +if (expression(F1)) redefine x "1"; +.sort +id x = `x'; +P F; +.end +assert succeeded? +assert result("F") =~ expr("0") +*--#] Issue525 : *--#[ Issue563 : #: SubTermsInSmall 50 diff --git a/sources/execute.c b/sources/execute.c index 5a270cf2..96947256 100644 --- a/sources/execute.c +++ b/sources/execute.c @@ -875,11 +875,6 @@ WORD DoExecute(WORD par, WORD skip) RetCode = PF_BroadcastModifiedDollars(); if ( RetCode ) return RetCode; } - /* Broadcast redefined preprocessor variables. */ - if ( AC.numpfirstnum > 0 ) { - RetCode = PF_BroadcastRedefinedPreVars(); - if ( RetCode ) return RetCode; - } /* Broadcast the list of objects converted to symbols in AM.sbufnum. */ if ( AC.topolynomialflag & TOPOLYNOMIALFLAG ) { RetCode = PF_BroadcastCBuf(AM.sbufnum); diff --git a/sources/parallel.c b/sources/parallel.c index 975f96c8..231c7ab2 100644 --- a/sources/parallel.c +++ b/sources/parallel.c @@ -1768,6 +1768,11 @@ int PF_Processor(EXPRESSIONS e, WORD i, WORD LastExpression) /* Now handle redefined preprocessor variables. */ if ( AC.numpfirstnum > 0 ) PF_UnpackRedefinedPreVars(); } + /* Broadcast redefined preprocessor variables. */ + if ( AC.numpfirstnum > 0 ) { + int RetCode = PF_BroadcastRedefinedPreVars(); + if ( RetCode ) return RetCode; + } if ( ! AC.OldParallelStats ) { /* Now we can calculate AT.SS->GenTerms from the statistics of the slaves. */ LONG genterms = 0; @@ -1917,6 +1922,11 @@ int PF_Processor(EXPRESSIONS e, WORD i, WORD LastExpression) /* Now handle redefined preprocessor variables. */ if ( AC.numpfirstnum > 0 ) PF_PackRedefinedPreVars(); PF_LongSingleSend(MASTER, PF_ENDSORT_MSGTAG); + /* Broadcast redefined preprocessor variables. */ + if ( AC.numpfirstnum > 0 ) { + int RetCode = PF_BroadcastRedefinedPreVars(); + if ( RetCode ) return RetCode; + } /* #] Collect (stats,prepro...) :