Skip to content

Commit

Permalink
Make sure that module scope variables of extern types are default ini…
Browse files Browse the repository at this point in the history
…talized (#26417)

Fixes an issue where module scope variables of an extern type where not
default initialized properly. This was caused by a dead store of
`PRIM_ZERO_VARIABLE` to a temporary, created by `makeHeapAllocations` in
the `parallel` pass.

The fix is to just set the temporary back to the "pointer"

This PR also adds a NUMLOCALES file to some C extern tests to ensure
they are run in nightly gasnet+asan tests

Resolves #26406

Testing
- [x] ran `start_test` with GASNet + ASAN tesing on
`test/extern/bharshbarg/` and `test/extern/ferguson/`
- [x] full paratest without comm
- [x] full paratest with comm

[Reviewed by @mppf]
  • Loading branch information
jabraham17 authored Jan 6, 2025
2 parents 96d9f65 + 632b6e5 commit 0905ab9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions compiler/passes/parallel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,12 @@ makeHeapAllocations() {
call->getStmtExpr()->insertBefore(new DefExpr(tmp));
call->getStmtExpr()->insertBefore(new CallExpr(PRIM_MOVE, tmp, new CallExpr(PRIM_GET_MEMBER_VALUE, use->symbol(), heapType->getField(1))));
use->replace(new SymExpr(tmp));
if (call->isPrimitive(PRIM_ZERO_VARIABLE)) {
// aftering zeroing the value, we need to set it back
// otherwise its a dead store
call->getStmtExpr()->insertAfter(
new CallExpr(PRIM_SET_MEMBER, use->symbol(), heapType->getField(1), tmp));
}
}
} else if (use->parentExpr)
INT_FATAL(var, "unexpected case");
Expand Down
1 change: 1 addition & 0 deletions test/extern/ferguson/NUMLOCALES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2

0 comments on commit 0905ab9

Please sign in to comment.