Repository navigation
Conversation
When the selector and result views alias, the SOT_UNION element propagators modified the selector before consuming an iterator over the result's lower bound, which could drop valid solutions (including from MiniZinc's roots(x, s, s)). Cache the lower-bound difference before modifying the selector for variable sets, and check the subset condition before modifying the selector for constant sets.
Posting ChannelInt bounds every integer variable to 0..ys.size()-1. With a single set variable that assigns every x[i] to 0, which matches the initial cache, so propagate() never sees x[i] as modified and never includes i in y[0]. This let the channel accept invalid solutions and broke MiniZinc's roots when the largest image value is 0. Include i in ys[xs[i].val()] at posting whenever xs[i] is already assigned.
OmegaNode and OmegaLambdaNode summed task processing and earliest completion times in int. When task durations summed beyond the integer limits, the sum overflowed and unary overload detection (also used for cumulative constraints reduced to unary) missed the overload. Store processing and completion times in long long int, clamp completion times to [-Limits::infinity, Limits::infinity] when reading from the trees, and subtract in long long int when updating task start bounds.
not_last() reset j to -1 on every iteration of the outer loop, so among tasks with equal latest completion or start times only the first in storage order received the tighter bound. Because not_first_not_last() runs not_last() forward and backward, propagation could differ between equivalent spaces with different task orders. Keep j across iterations and insert tasks with equal latest start time together, following Vilím's algorithm, in a shared not_last_bounds() helper used by both mandatory and optional tasks.
MiniZinc's reified construction for a native regular propagator failed on values outside 1..S instead of reifying them to false. Set fzn_regular_is_decomposed = true in fzn_regular.mzn so reified regular uses MiniZinc's standard decomposition (with an absorbing dead state), while non-reified regular keeps using gecode_regular.
When posting cumulative, Gecode checks whether the two smallest task usages exceed the capacity so it can reduce to unary. With a single task, the second-smallest usage stays INT_MAX, so min_u + min_u2 overflowed signed int when min_u was positive. Sum in long long int to avoid signed overflow; a single task now takes the unary branch.
RangeList::copy() stored the incoming value of its output pointer r in its sentinel before overwriting it. Integer and set trace views pass an uninitialized RangeList* when created or cloned, so that dead store read uninitialized memory. Remove the dead sentinel.next(r) call.
For the order relations SRT_LQ, SRT_LT, SRT_GQ, and SRT_GR, rel(home, x, op, y, r, z) created its auxiliary set variable for x op y over the full set universe. Because the set order propagator walks every value of the upper bound, posting these relations was extremely slow and memory-intensive. Bound the auxiliary set by the union of lub(x) and lub(y) for SOT_UNION and SOT_DISJOINT_UNION, their intersection for SOT_INTERSECTION, and lub(x) for SOT_MINUS.
|
No actionable comments were generated in the recent review. Walkthrough
Change: Bug fix Merge Risk:
|
Fixes seven bugs across set constraints, unary and cumulative scheduling, MiniZinc
regular, and trace-view range lists, and bounds the auxiliary set created by set order relations with a set operation. Each fix has a regression test that fails (or triggers ASan/UBSan) onmainand passes on this branch.Fixes
SOT_UNION(variable and constant set arrays) when the selector is also the result, as inroots(x, s, s). The propagator modified the selector before consuming an iterator over the result's lower bound. Tests:Set::Element::Union::SharedandSet::Element::UnionConst::Shared— both fail onmain, pass here.rootswhen the largest value its image can contain is 0). Boundingx[i]to0..0matched the initial cache, sopropagate()never includediiny[0]. Test:Set::Channel::Int::Single— fails onmain, passes here.intlimits.OmegaNodeandOmegaLambdaNodenow accumulate inlong long intand clamp when reading back. Test:Int::Unary::LongTaskOverload(three tasks of length 10^9 must end by 2*10^9) — onmainthe space does not fail and UBSan reports signed overflow ingecode/int/unary/tree.hpp; here it fails as expected and UBSan is clean.Int::Unary::TiedNotLast(posts the same tasks in two orders and expects the same bound 12) — fails onmain, passes here. The sweep replayInt::Unary::Opt::Fix::0::[4,0,3,3,0,5]::Def+A, which previously reported "different result after re-enable", also passes.regular(Gecode'smznlib) when a value lies outside1..S.fzn_regular.mznnow uses MiniZinc's standard decomposition for the reified form while keepinggecode_regularfor the non-reified form. Test: new case in.github/ci/flatzinc-tools-smoke.sh(run in CI with MiniZinc 2.10.1; the FlatZinc test framework starts from FlatZinc text and cannot seemznlib). Run by hand with MiniZinc 2.11.0:=====UNSATISFIABLE=====onmain,regular-x=3here.cumulativewith a single task while deciding whether to use the unary propagator; results were not affected in practice. Tests:Int::Cumulative::SingleTask::TypedandInt::Cumulative::SingleTask::Untyped— both pass in Release either way; under UBSan,mainreportssigned integer overflow: 1 + 2147483647atgecode/int/cumulative.cpp:70, clean here.RangeList::copy()read its uninitialized output pointer before overwriting it. Test: existingFlatZinc::Branching::AuxVarClone— under ASan+UBSan,mainreportsupcast of misaligned address 0xbebebebebebebebeinrange-list.hpp, clean here.Performance
rel(home, x, op, y, r, z)forSRT_LQ,SRT_LT,SRT_GQ, andSRT_GRpreviously created its auxiliary set variable over the whole set universe; it is now bounded by the operands' upper bounds. Solutions are unchanged. New tests:Set::RelOp::Order::*(16 tests; order relations were not covered forrelwith an operation before) — onmainthey did not finish within 10 minutes and reached 8 GB of memory; here all 16 pass in 0.7 s.Left out
A FlatZinc parser change that checks the argument count of equality, domain, and on-restart constraints before reading fixed argument positions. On
mainthe constraint posters do not check argument counts either, so guarding only the parser would just move the out-of-range read into the poster. Adding argument-count checks to the posters first is a separate change. Because the parser is unchanged, no regeneration was needed.Testing
All run on this branch:
mainand passes with its fix, as above.Set::Element(27),Set::Channel(15),Int::Unary(152),Int::Cumulative(5095, includesCumulatives),Set::RelOp(856),Set::Rel(20),FlatZinc(161), andInt::NoOverlap(17) — all pass.Set::Element,Set::Channel,Int::Unary,Int::Cumulative,Set::RelOp, andFlatZinc(all tags) — all pass with no report; check suite: 570 tests, all pass with no report.check-standardtarget (7012 tests) — all pass.misc/check.py lint(full tree, clang-tidy 22) exited 0;format-checkclean;misc/tidy.py --checkpassed.Summary by CodeRabbit
regularconstraint results for values outside the valid range.