Skip to content

Preserve the type of folded atomic lock-free queries [GH #599] - #596

Queued
mbaluda wants to merge 1 commit into
edgcpp:mainfrom
mbaluda:fix/lock-free-atomic-constraint
Queued

mbaluda wants to merge 1 commit into
edgcpp:mainfrom
mbaluda:fix/lock-free-atomic-constraint

Conversation

@mbaluda

@mbaluda mbaluda commented Nov 26, 2026 •

Copy link
Copy Markdown

Preserve the built-in result type when folding atomic lock-free queries; add a focused test.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed constant-folded lock-free atomic queries so their results retain the Boolean type, including when used in C++20 atomic constraints.
  • Tests

    • Added regression coverage for Boolean result types and C++20 atomic constraints across supported compiler configurations.
  • Documentation

    • Documented the lock-free query type correction.

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The lock-free query folding code now preserves the built-in result type after producing a constant. Regression tests cover query result types and C++20 atomic constraints.

Changes: Lock-free query result

Layer / File(s) Summary
Restore the folded result type
src/folding.c, tests/tests/regressions/gh-599-lock-free-query-type.sft.cpp, tests/tests/regressions/.gh-599-lock-free-query-type.rto/*, tests/tests/regressions/gh-599-lock-free-atomic-constraint.sft.cpp, tests/tests/regressions/.gh-599-lock-free-atomic-constraint.rto/*, src/pending_changes/gh-599-lock-free-query-type.txt
The folding code restores the result type after producing 0 or 1 for the supported query cases. Regression tests check the built-ins’ return types and test concept satisfaction for char and char[3]. The pending-changes note describes the reported type mismatch and its effect on an atomic constraint.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • Issue 599: The issue describes the lock-free query result-type mismatch and C++20 constraint failure covered by this change.

Suggested reviewers: daveedvdv-nvidia, nv-cmeerw

Merge Risk: Minimal · up to 88257

This change makes folded atomic lock-free queries keep their built-in Boolean result type, which fixes a C++20 constraint that was rejected. Regression tests cover it, and no remaining merge risk is identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Preserve the type of folded atomic lock-free queries [GH #599]" matches the main change in the changeset. The change in src/folding.c restores the built-in Boolean return type of folded __a…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Preserve the type of folded atomic lock-free queries [GH #599]" matches the main change in the changeset. The change in src/folding.c restores the built-in Boolean return type of folded __atomic_always_lock_free, __atomic_is_lock_free, and __c11_atomic_is_lock_free results. The pending-changes note, the regression tests, and the PR objectives all describe this same goal. The title is specific and concise and does not use vague terms.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between d840e0d and 8825757.

Files selected for processing: 8

  • src/folding.c
  • src/pending_changes/gh-599-lock-free-query-type.txt
  • tests/tests/regressions/.gh-599-lock-free-atomic-constraint.rto/default.1.1.txt
  • tests/tests/regressions/.gh-599-lock-free-atomic-constraint.rto/default.2.1.txt
  • tests/tests/regressions/.gh-599-lock-free-query-type.rto/default.1.1.txt
  • tests/tests/regressions/.gh-599-lock-free-query-type.rto/default.2.1.txt
  • tests/tests/regressions/gh-599-lock-free-atomic-constraint.sft.cpp
  • tests/tests/regressions/gh-599-lock-free-query-type.sft.cpp

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@edgcpp-bot

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for 5d4ca315475b:

CI failure.

@edgcpp-bot

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for 9809a6840802:

CI failure.

@nv-cmeerw

Copy link
Copy Markdown
Contributor

Created #599

@mbaluda mbaluda changed the title Preserve the type of folded atomic lock-free queries Preserve the type of folded atomic lock-free queries [GH #612] Nov 27, 2026
@mbaluda mbaluda changed the title Preserve the type of folded atomic lock-free queries [GH #612] Preserve the type of folded atomic lock-free queries [GH #599] Nov 27, 2026
@mbaluda
mbaluda marked this pull request as ready for review November 27, 2026 10:43
@mbaluda
mbaluda requested a review from a team November 27, 2026 10:43
@mbaluda mbaluda closed this Nov 27, 2026
@mbaluda mbaluda reopened this Nov 27, 2026
@edgcpp-bot

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for 9809a6840802:

CI failure.

@mbaluda
mbaluda force-pushed the fix/lock-free-atomic-constraint branch from 9809a68 to d840e0d Compare December 1, 2026 20:12
@edgcpp-bot

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for d840e0d932df:

@edgcpp-bot

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for d840e0d932df:

CI success.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mbaluda
mbaluda force-pushed the fix/lock-free-atomic-constraint branch from d840e0d to 8825757 Compare December 2, 2026 14:56
@edgcpp-bot

Copy link
Copy Markdown
Collaborator

AcknowlEDG review results updated for 88257578fdb3:

CI success.

@nv-cmeerw
nv-cmeerw added this pull request to the merge queue Dec 2, 2026

This branch has not been deployed

No deployments
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.

3 participants