[Users] Bug in Piraha / trac.einsteintoolkit.org is down

Erik Schnetter schnetter at gmail.com
Tue May 21 09:56:25 CDT 2019


I just found and corrected a problem in how Piraha handles the "min"
and "max" functions in parameter files:

(1) Piraha processes the first argument twice. (This isn't really a
bug since min and max are idempotent.)

(2) Piraha stops after processing the first element since a "return"
statement is placed wrong.

The diff below corrects both problems.

-erik



$ git diff
diff --git a/src/piraha/Call.cc b/src/piraha/Call.cc
index cf777d58..facd2565 100644
--- a/src/piraha/Call.cc
+++ b/src/piraha/Call.cc
@@ -405,7 +405,7 @@ smart_ptr<Value> meval(smart_ptr<Group>
gr,ExpressionEvaluationData *eedata) {
                 std::string par = get_parfile();

CCTK_Error(gr->line(),par.c_str(),current_thorn.c_str(),msg.str().c_str());
             }
-            for (int i=1; i<=gr->groupCount(); i++) {
+            for (int i=2; i<=gr->groupCount(); i++) {
                 smart_ptr<Value> val_next = meval(gr->group(i),eedata);
                 // Make sure all arguments are either integer or real
                 if (val_next->type != PIR_REAL && val_next->type != PIR_INT) {
@@ -437,8 +437,8 @@ smart_ptr<Value> meval(smart_ptr<Group>
gr,ExpressionEvaluationData *eedata) {
                     std::string par = get_parfile();

CCTK_Error(gr->line(),par.c_str(),current_thorn.c_str(),"internal
error");
                 }
-                return val;
             }
+            return val;
         }
         // From here on only functions that take exactly one
argument: the majority.
         else if (gr->groupCount() != 2) {


-- 
Erik Schnetter <schnetter at gmail.com>
http://www.perimeterinstitute.ca/personal/eschnetter/


More information about the Users mailing list