You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Crash: an array initializer (new T[] {...}) passed to a parameter refined with length() gives "Sorts ... and Bool are incompatible" #448
Impact: a correct call is rejected with an internal Z3 error whenever an array initializer is passed to a parameter whose refinement mentions length() of that array. This hits every array type, including int[]. new byte[2] and a variable both work. This is not #355, which was about .length of non-int arrays and is closed.
error (and the same for char[], short[], long[], double[], boolean[]; int[] gives Sorts (Array Int Int) and Bool are incompatible)
new byte[2]
passes
byte[] b2 = new byte[2]; put(b2, 2);
passes
Real-world scenario. I found this while checking a spec of java.io.PipedOutputStream. Its write(byte[] b, int off, int len) throws IndexOutOfBoundsException unless the range is inside the array, so the spec refines off and len:
Writing a small literal message, a common way to send a header or a test payload, then fails with the error above:
PipedOutputStreamo = newPipedOutputStream(newPipedInputStream());
o.write(newbyte[] {1, 2}, 0, 2); // runs fine; LiquidJava: Sorts |byte[]| and Bool are incompatible
The same refinement works when the array is created with a size (new byte[4]) or held in a variable. So the out-of-range check is useful, but it breaks on literal arrays.
Activity