What happened. A salience far outside the documented range was accepted, and the rule was defined with whatever salience the narrowing left behind.
(defrule r (declare (salience 4294967296)) =>)
was accepted and stored salience 0. (declare (salience 4294977296)) was accepted and stored 10000. So was -4294967296, and so was the most negative integer, and so was the most positive.
(declare (salience 10001)) was correctly refused, which is what hides it: the values that fail are the ones small enough for the narrowing to leave alone.
Why it is a fix and not a preference. Section 5.4.10.1 says the salience expression should evaluate to an integer between −10000 and 10000. Appendix F documents PRNTUTIL9 as the report for a salience outside that range, and its example is 20000 — a value that fits in an int and is rejected.
EvaluateSalience in agenda.c, which handles a salience re-evaluated at run time, compares the long long against the same two limits before storing anything. The parse-time path did not, so the same declaration was judged by two different rules depending on when it was looked at.
Where it came from. ParseSalience in clips_core_source_642/core/rulelhs.c:
int salience;
...
salience = (int) salienceValue.integerValue->contents;
if ((salience > MAX_DEFRULE_SALIENCE) || (salience < MIN_DEFRULE_SALIENCE))
The C standard leaves the conversion of an out-of-range value to a signed type implementation-defined. On this host int is four bytes, 4294967296 converts to 0 and 4294977296 converts to 10000, and the test that follows is then asking about a number nobody wrote.
The change. salience is a long long, the conversion is gone, and the range test is made on the value as it was read. The narrowing happens afterwards, where GlobalSalience is assigned, and is safe there because the test has already bounded the value between −10000 and 10000.
What was checked. Both ends of the range accepted, both just outside refused, and five values that the narrowing used to let through now refused: two that wrap to inside the range, one that wraps negative, and the two extremes of the type. A salience given as an expression rather than a literal, in range and out. A run after all of it, so the agenda is exercised rather than only the parser.
Anonymous
Present in 7.0? Not checked.