Skip to content

Initialize all coordinates in global to local test - #403

Merged
jacobmerson merged 1 commit into
SCOREC:developfrom
jacobmerson:fix-point-search-uninit
Oct 27, 2026
Merged

jacobmerson merged 1 commit into
SCOREC:developfrom
jacobmerson:fix-point-search-uninit

Conversation

@jacobmerson

Copy link
Copy Markdown
Collaborator

TEST_CASE("global to local") in test/test_point_search.cpp builds its triangle as

Omega_h::Matrix<2, 3> coords{{0.0}, {1, 0}, {0.5, 1}};

{0.0} only sets the first vertex's x coordinate. Omega_h's Few(std::initializer_list) constructor initializes just the elements it is given, so the y coordinate is whatever was on the stack. Whether the test passes depends on that leftover value: it passes on x86 and on macOS, but failed on aarch64 with gcc 14 in the scorec-spack-packages CI (SCOREC/scorec-spack-packages#36).

Running unit_tests under valgrind reports the uninitialized read, originating in this test's stack frame; with this fix valgrind reports no errors for unit_tests.

The fix gives the first vertex both coordinates: {0.0, 0.0}.

The first vertex was {0.0}, which leaves its y coordinate uninitialized:
Omega_h's Few initializer_list constructor only sets the elements given.
The test passed or failed depending on leftover stack contents; it failed
on aarch64 with gcc 14. Valgrind reported the uninitialized read.
@jacobmerson
jacobmerson merged commit 5187986 into SCOREC:develop Oct 27, 2026
9 checks passed

This branch was successfully deployed

1 active deployment
asics — 59a3a952 Deployed Oct 27, 2026 by jacobmerson via build_and_test #379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant