Skip to content

Commit

Permalink
Guard the iterator check as well
Browse files Browse the repository at this point in the history
Avoids a failure for test/types/range/elliot/anonymousRangeIter.chpl, presumably
because it modifies the generated code just enough to tweak it.

----
Signed-off-by: Lydia Duncan <[email protected]>
  • Loading branch information
lydia-duncan committed Feb 16, 2024
1 parent 8d2b8cd commit 8bd695d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions compiler/AST/iterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1847,9 +1847,11 @@ rebuildIterator(IteratorInfo* ii,

fn->insertAtTail(new DefExpr(iterator));

// Lydia 2/14/24 todo: only do this when we're performing the constness
// checks?
fn->insertAtTail(new CallExpr(PRIM_ZERO_VARIABLE, new SymExpr(iterator)));
// Avoids a valgrind warning about uninitialized memory when performing
// indirect modification checks on const and default intent arguments
if (fWarnUnstable && !fNoConstArgChecks) {
fn->insertAtTail(new CallExpr(PRIM_ZERO_VARIABLE, new SymExpr(iterator)));
}

// For each live argument
forv_Vec(Symbol, local, locals) {
Expand Down

0 comments on commit 8bd695d

Please sign in to comment.