Changeset 16e0dcb


Ignore:
Timestamp:
Nov 17, 2023, 3:23:15 PM (6 months ago)
Author:
caparson <caparson@…>
Branches:
master
Children:
f7f997a
Parents:
0f6d2884
Message:

fixed error where order of argument eval in compiler could cause different code to be generated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Concurrency/Waituntil.cpp

    r0f6d2884 r16e0dcb  
    492492// the predicate expr used inside the predicate functions
    493493Expr * genPredExpr( const CodeLocation & loc, WaitUntilStmt::ClauseNode * currNode, int & idx, GenLeafExpr genLeaf ) {
     494    Expr * leftExpr, * rightExpr;
    494495    switch (currNode->op) {
    495496        case WaitUntilStmt::ClauseNode::AND:
     497            leftExpr = genPredExpr( loc, currNode->left, idx, genLeaf );
     498            rightExpr = genPredExpr( loc, currNode->right, idx, genLeaf );
    496499            return new LogicalExpr( loc,
    497                 new CastExpr( loc, genPredExpr( loc, currNode->left, idx, genLeaf ), new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast ),
    498                 new CastExpr( loc, genPredExpr( loc, currNode->right, idx, genLeaf ), new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast ),
     500                new CastExpr( loc, leftExpr, new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast ),
     501                new CastExpr( loc, rightExpr, new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast ),
    499502                LogicalFlag::AndExpr
    500503            );
     504            break;
    501505        case WaitUntilStmt::ClauseNode::OR:
     506            leftExpr = genPredExpr( loc, currNode->left, idx, genLeaf );
     507            rightExpr = genPredExpr( loc, currNode->right, idx, genLeaf );
    502508            return new LogicalExpr( loc,
    503                 new CastExpr( loc, genPredExpr( loc, currNode->left, idx, genLeaf ), new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast ),
    504                 new CastExpr( loc, genPredExpr( loc, currNode->right, idx, genLeaf ), new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast ),
     509                new CastExpr( loc, leftExpr, new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast ),
     510                new CastExpr( loc, rightExpr, new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast ),
    505511                LogicalFlag::OrExpr );
     512            break;
    506513        case WaitUntilStmt::ClauseNode::LEAF:
    507514            return genLeaf( loc, idx );
     515            break;
    508516        default:
    509             assertf(false, "Unreachable waituntil clause node type. How did you get here???");
    510     }
     517            assertf(false, "Unreachable waituntil clause node type. How did you get here???");\
     518            return nullptr;
     519            break;
     520    }
     521    return nullptr;
    511522}
    512523
Note: See TracChangeset for help on using the changeset viewer.