Skip to content

Commit

Permalink
fix #974 (asm mode): crash with i8 vector load
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoplopes committed Nov 27, 2023
1 parent bb48c93 commit 9bad2f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ir/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ static StateValue bytesToValue(const Memory &m, const vector<Byte> &bytes,
for (auto &b: bytes) {
expr isptr = ub_pre(!b.isPtr());
StateValue v(is_asm ? b.forceCastToInt() : b.nonptrValue(),
is_asm ? !b.isPoison()
is_asm ? (!b.isPoison()).toBVBool()
: ibyteTy.combine_poison(isptr, b.nonptrNonpoison()));
val = first ? std::move(v) : v.concat(val);
first = false;
Expand Down
2 changes: 2 additions & 0 deletions tests/alive-tv/asm/load.srctgt.ll
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
; TEST-ARGS: -tgt-is-asm

target datalayout = "e-i64:64"

@g = external global i64
Expand Down
11 changes: 11 additions & 0 deletions tests/alive-tv/asm/vector-load.srctgt.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
; TEST-ARGS: -tgt-is-asm

define <1 x i8> @src(ptr %0) {
%2 = load <1 x i8>, ptr %0, align 4
ret <1 x i8> %2
}

define <1 x i8> @tgt(ptr %0) {
%a2_11 = load <1 x i8>, ptr %0, align 2
ret <1 x i8> %a2_11
}

0 comments on commit 9bad2f5

Please sign in to comment.