Skip to content

[Tests] Fix undefined behavior in shammath/solve::least_squares test - #2098

Open
tdavidcl wants to merge 1 commit into
Shamrock-code:mainfrom
tdavidcl:claude/least-squares-test-flakiness-e4s6be
Open

[Tests] Fix undefined behavior in shammath/solve::least_squares test#2098
tdavidcl wants to merge 1 commit into
Shamrock-code:mainfrom
tdavidcl:claude/least-squares-test-flakiness-e4s6be

Conversation

@tdavidcl

Copy link
Copy Markdown
Member

The comparison loop used an uninitialized loop counter (size_t i; instead of size_t i = 0;), so its starting value was whatever garbage was left on the stack. Depending on compiler/optimization level, this could skip comparisons entirely (silently passing a bad fit) or read out of bounds, explaining the flaky/non-deterministic CI failures. Also fixed a related out-of-bounds read: ex_res only had 3 entries but was indexed up to 3 (missing the expected R^2 value).

Assisted-by: Claude

The comparison loop used an uninitialized loop counter (`size_t i;`
instead of `size_t i = 0;`), so its starting value was whatever
garbage was left on the stack. Depending on compiler/optimization
level, this could skip comparisons entirely (silently passing a bad
fit) or read out of bounds, explaining the flaky/non-deterministic CI
failures. Also fixed a related out-of-bounds read: `ex_res` only had
3 entries but was indexed up to 3 (missing the expected R^2 value).

Assisted-by: Claude
@github-actions

Copy link
Copy Markdown
Contributor

Thanks @tdavidcl for opening this PR!

You can do multiple things directly here:
1 - Comment pre-commit.ci run to run pre-commit checks.
2 - Comment pre-commit.ci autofix to apply fixes.
3 - Add label autofix.ci to fix authorship & pre-commit for every commit made.
4 - Add label full-ci to run the full test suite (default is light CI; full CI also runs on Mergify merge-queue branches).
5 - Add label trigger-ci to create an empty commit to trigger the CI.

Once the workflow completes a message will appear displaying informations related to the run.

Also the PR gets automatically reviewed by gemini, you can:
1 - Comment /gemini review to trigger a review
2 - Comment /gemini summary for a summary
3 - Tag it using @gemini-code-assist either in the PR or in review comments on files

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@tdavidcl, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Limit details: You’ve used all 1 included review currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e2a9acb7-beba-4232-b43b-37b78174ce18

📥 Commits

Reviewing files that changed from the base of the PR and between 92cccdf and 6b53feb.

📒 Files selected for processing (1)
  • src/tests/shammath/matrixTests.cpp

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Workflow report

workflow report corresponding to commit 6b53feb
Commiter email is noreply@anthropic.com

Light CI is enabled (the default for pull requests). This will only run the basic tests and not the full tests.
Full CI runs if the full-ci label is set, or automatically on Mergify merge-queue branches (mergify/merge-queue/*).
The merge gate job "on PR / all" is skipped in this case. Queue entry uses "on PR / all_light"; full CI runs in the merge queue.

Pre-commit check report

Pre-commit check: ✅

trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check for merge conflicts................................................Passed
check that executables have shebangs.....................................Passed
check that scripts with shebangs are executable..........................Passed
check for added large files..............................................Passed
check for case conflicts.................................................Passed
check for broken symlinks................................................Passed
check yaml...............................................................Passed
detect private key.......................................................Passed
No-tabs checker..........................................................Passed
Tabs remover.............................................................Passed
cmake-format.............................................................Passed
Validate GitHub Workflows................................................Passed
clang-format.............................................................Passed
ruff check...............................................................Passed
ruff format..............................................................Passed
Check doxygen headers....................................................Passed
Check license headers....................................................Passed
Check #pragma once.......................................................Passed
Check SYCL #include......................................................Passed
No ssh in git submodules remote..........................................Passed
No UTF-8 in files (except for authors)...................................Passed

Test pipeline can run.

Clang-tidy diff report

No relevant changes found.
Well done!

You should now go back to your normal life and enjoy a hopefully sunny day while waiting for the review.

Doxygen diff with main

Removed warnings : 0
New warnings : 0
Warnings count : 8183 → 8183 (0.0%)

Detailed changes :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants