Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOTFIX define Int2Bytes for -1 again #4554

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion k-distribution/include/kframework/builtin/domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -2217,7 +2217,9 @@ module BYTES
rule Int2Bytes(I::Int, E::Endianness, Signed ) => Int2Bytes((log2Int(I) +Int 9) /Int 8, I, E)
requires I >Int 0 [preserves-definedness]
rule Int2Bytes(I::Int, E::Endianness, Signed ) => Int2Bytes((log2Int(~Int I) +Int 9) /Int 8, I, E)
requires I <Int 0 [preserves-definedness]
requires I <Int -1 [preserves-definedness]
rule Int2Bytes(I::Int, E::Endianness, Signed ) => Int2Bytes(1, -1, E)
requires I ==Int -1 [preserves-definedness]
endmodule
```

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<k>
b"" ~> .K
</k>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<k>
b"\x01\x04" ~> .K
</k>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<k>
b"" ~> .K
</k>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<k>
b"\x04\x01" ~> .K
</k>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
12
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<k>
b"\x04\x01" ~> .K
</k>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
13
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<k>
b"\xff" ~> .K
</k>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<k>
b"\xfb\xff" ~> .K
</k>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<k>
b"\x01\x04" ~> .K
</k>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<k>
b"\xff" ~> .K
</k>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<k>
b"\xff\xfb" ~> .K
</k>
6 changes: 6 additions & 0 deletions k-distribution/tests/regression-new/int2bytes-no-len/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DEF=test
EXT=test
TESTDIR=.
KOMPILE_BACKEND=llvm
KOMPILE_FLAGS=--syntax-module TEST
include ../../../include/kframework/ktest.mak
23 changes: 23 additions & 0 deletions k-distribution/tests/regression-new/int2bytes-no-len/test.k
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Runtime Verification, Inc. All Rights Reserved.
// testing that krun pretty prints corectly Bytes
// kx should replace krun though, so if this test
// prevents a future upgrade, it should be removed

module TEST
imports BYTES
imports INT

configuration <k> $PGM:Int </k>
rule 0 => Int2Bytes(0, LE, Unsigned) +Bytes Int2Bytes(0, LE, Signed)
rule 1 => Int2Bytes(1025, LE, Unsigned)
rule 2 => Int2Bytes(1025, LE, Signed)
rule 3 => Int2Bytes(-1, LE, Signed)
rule 4 => Int2Bytes(-1025, LE, Signed)

rule 10 => Int2Bytes(0, BE, Unsigned) +Bytes Int2Bytes(0, BE, Signed)
rule 11 => Int2Bytes(1025, BE, Unsigned)
rule 12 => Int2Bytes(1025, BE, Signed)
rule 13 => Int2Bytes(-1, BE, Signed)
rule 14 => Int2Bytes(-1025, BE, Signed)

endmodule
Loading