Hi,

I'm Shuxin. Recently I came across this test case in which BaseX returned
an incorrect result. Currently I could not confirm it as a bug and is only
a corner case which might not be of importance, but there are some
interesting behaviors which I'm also curious about.

Give XML document

<A1 id="1"><B1 id="2"></B1><B1 id="3"></B1></A1>

and XPath query

//A1[((count(./*) idiv 3) * -1763118392 * 2144097893) != 1]

BaseX return empty result set while node A1 should be returned. This should
be related to overflow since making either number smaller BaseX will then
return correct result and therefore could be considered not a bug. But
interestingly, this only occurs when the operand given after idiv (in this
case 3) is greater than 2, which result is 0. If changed to (count(./*)
idiv 2) or  (count(./*) idiv 1), the operand is larger but correct results
are still returned. Simply substituting the whole (count(./*) idiv 3) to
constant either 0, 1, 2 all returns correct results. This indicates that
BaseX should have the ability of handling this expression, but is somehow
affected. The version of BaseX I produced this on is the latest development
commit e607ecc.

Still, this is just a corner case which might not require a fix. I submit
this report just for your reference. Thank you very much!

Best Regards,
Shuxin Li
2023.4.5

Reply via email to