Skip to content

Fix default BoolExpr accumulator construction#216

Open
zayenz wants to merge 41 commits into
mainfrom
feature/bool-expr-default-consrruction
Open

Fix default BoolExpr accumulator construction#216
zayenz wants to merge 41 commits into
mainfrom
feature/bool-expr-default-consrruction

Conversation

@zayenz

@zayenz zayenz commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

Fixes #139 by making a default-constructed BoolExpr behave as an empty accumulator during Boolean expression composition.

A default BoolExpr now acts as an identity for both && and || composition, so empty && x, x && empty, empty || x, and x || empty all collapse to x. This avoids choosing a global true/false meaning that would make one accumulator style silently wrong.

Posting or materializing a still-empty BoolExpr now fails explicitly with MiniModel::TooFewArguments("BoolExpr") instead of reading uninitialized node state.

Validation

  • cmake -S . -B /tmp/gecode-bool-expr-build -DCMAKE_BUILD_TYPE=Debug -DGECODE_ENABLE_EXAMPLES=OFF -DGECODE_ENABLE_GIST=OFF -DGECODE_ENABLE_QT=OFF
  • cmake --build /tmp/gecode-bool-expr-build --target gecode-test -j 8
  • /tmp/gecode-bool-expr-build/bin/gecode-test -test MiniModel::BoolExpr::Default
  • /tmp/gecode-bool-expr-build/bin/gecode-test -test MiniModel::BoolExpr
  • worker also validated the autoconf path: ./configure --disable-qt --disable-gist --disable-examples --disable-flatzinc --disable-float-vars --disable-set-vars --disable-mpfr, make -j4 test, and DYLD_LIBRARY_PATH=. ./test/test -test MiniModel::BoolExpr

@zayenz zayenz marked this pull request as ready for review July 7, 2026 14:30

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@zayenz zayenz force-pushed the feature/bool-expr-default-consrruction branch 2 times, most recently from 063cf60 to 420234c Compare July 10, 2026 14:40
Mikael Zayenz Lagerkvist added 26 commits July 10, 2026 22:50
Close follow-up gaps found while validating the local clone,
IntSet, and MiniModel exception-safety invariants. In particular,
recover advisor-copy state on failure, keep IntSet fault accounting
consistent when allocation throws, and make MiniModel ownership
cleanup robust under injected heap failures.

Reference: #211
Pass the incumbent best solution as an optional pointer during BAB path
recomputation. Recompute can run before an incumbent exists; the previous
reference parameter forced callers to dereference a null best pointer and
tripped UBSan.
Replace shared volatile search flags and stop limits with atomics, and close a
racy path-steal check. TSan reported concurrent reads and writes in parallel
engines and portfolio stop propagation; these fields are cross-thread
coordination state.
Mikael Zayenz Lagerkvist added 15 commits July 10, 2026 22:50
Delete portfolio slave engines in the PBS destructor before freeing the slave
pointer array. This closes the lifetime leak exposed by sanitizer runs.
Address the remaining findings from the larger sanitizer matrix: harden
integer-domain width arithmetic, avoid invalid marked-link casts, protect RBS
stop state, and make thread-runner cleanup tolerate null terminators.
Add release-note entries and file-header attribution for the clone,
IntSet, MiniModel, fault-injection, and sanitizer-stability changes.

PR 211 is kept as release-note issue metadata and as a reference for
original patch authorship where that context matters.

Reference: #211
Use relaxed atomics for the fault-injection live-allocation counters used by IntSet and MiniModel leak checks. These counters are diagnostics only, but fault-enabled TSan search runs can construct and destroy the instrumented objects concurrently.
@zayenz zayenz force-pushed the feature/bool-expr-default-consrruction branch from 420234c to 592eed8 Compare July 10, 2026 20:52
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