AliveToolkit / alive2

Automatic verification of LLVM optimizations
MIT License
721 stars 93 forks source link

ir/memory.cpp:309: smt::expr IR::Byte::nonPoison() const: Assertion `!np.isValid() || ptrNonpoison().eq(np == 1)' failed. #987

Closed regehr closed 6 months ago

regehr commented 6 months ago
regehr@john-home:~/alive2-regehr/build$ cat src.ll
; ModuleID = 'M2'
source_filename = "M2"
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-linux-gnu"

; Function Attrs: nounwind
define void @func_ptr_type(ptr %0) {
  %2 = load ptr, ptr poison, align 8
  store ptr %2, ptr %0, align 8
  ret void
}

!llvm.module.flags = !{!0, !1}

!0 = !{i32 2, !"Dwarf Version", i32 2}
!1 = !{i32 2, !"Debug Info Version", i32 3}
regehr@john-home:~/alive2-regehr/build$ cat tgt.ll
; ModuleID = 'M2'
source_filename = "M2"
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-linux-gnu"

; Function Attrs: mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none)
define void @func_ptr_type(ptr nocapture readnone %0) local_unnamed_addr #0 {
arm_tv_entry:
  unreachable
}

attributes #0 = { mustprogress nofree norecurse noreturn nosync nounwind willreturn memory(none) }
regehr@john-home:~/alive2-regehr/build$ ./alive-tv src.ll tgt.ll --tgt-is-asm

----------------------------------------
define void @func_ptr_type(ptr %#0) {
#1:
  %#2 = load ptr, ptr poison, align 8
  assume_dereferenceable ptr poison, i64 8
  store ptr %#2, ptr %#0, align 8
  ret void
}
=>
define void @func_ptr_type(ptr nocapture noread nowrite %#0) noreturn nofree willreturn asm memory(none) {
arm_tv_entry:
  assume i1 0
}
alive-tv: /home/regehr/alive2-regehr/ir/memory.cpp:309: smt::expr IR::Byte::nonPoison() const: Assertion `!np.isValid() || ptrNonpoison().eq(np == 1)' failed.
 #0 0x00007faecfe01710 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/regehr/llvm-project/for-alive/lib/libLLVMSupport.so.18git+0x201710)
 #1 0x00007faecfdfe71f llvm::sys::RunSignalHandlers() (/home/regehr/llvm-project/for-alive/lib/libLLVMSupport.so.18git+0x1fe71f)
 #2 0x00007faecfdfe875 SignalHandler(int) Signals.cpp:0:0
 #3 0x00007faecf442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007faecf4969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007faecf4969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007faecf4969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007faecf442476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007faecf4287f3 abort ./stdlib/abort.c:81:7
 #9 0x00007faecf42871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007faecf439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x000055e7a7e92442 IR::Byte::nonPoison() const (./alive-tv+0xb5442)
#12 0x000055e7a7e9511e IR::Byte::refined(IR::Byte const&) const (./alive-tv+0xb811e)
#13 0x000055e7a7e994e8 IR::Memory::blockValRefined(IR::Memory const&, unsigned int, bool, smt::expr const&, std::set<smt::expr, std::less<smt::expr>, std::allocator<smt::expr>>&) const (./alive-tv+0xbc4e8)
#14 0x000055e7a7e99729 IR::Memory::blockRefined(IR::Pointer const&, IR::Pointer const&, unsigned int, std::set<smt::expr, std::less<smt::expr>, std::allocator<smt::expr>>&) const (./alive-tv+0xbc729)
#15 0x000055e7a7e9ea12 IR::Memory::refined(IR::Memory const&, bool, std::vector<IR::Memory::PtrInput, std::allocator<IR::Memory::PtrInput>> const*, std::vector<IR::Memory::PtrInput, std::allocator<IR::Memory::PtrInput>> const*) const (./alive-tv+0xc1a12)
#16 0x000055e7a7f14a96 check_refinement(util::Errors&, tools::Transform const&, IR::State&, IR::State&, IR::Value const*, IR::Type const&, IR::State::ValTy const&, IR::State::ValTy const&, bool) transform.cpp:0:0
#17 0x000055e7a7f1a767 tools::TransformVerify::verify() const (./alive-tv+0x13d767)
#18 0x000055e7a7e1cb47 (anonymous namespace)::verify(llvm::Function&, llvm::Function&, llvm::TargetLibraryInfoWrapperPass&, smt::smt_initializer&, std::ostream&, bool, bool) compare.cpp:0:0
#19 0x000055e7a7e1edf4 llvm_util::Verifier::compareFunctions(llvm::Function&, llvm::Function&) (./alive-tv+0x41df4)
#20 0x000055e7a7e13038 main (./alive-tv+0x36038)
#21 0x00007faecf429d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#22 0x00007faecf429e40 call_init ./csu/../csu/libc-start.c:128:20
#23 0x00007faecf429e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#24 0x000055e7a7e14185 _start (./alive-tv+0x37185)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: ./alive-tv src.ll tgt.ll --tgt-is-asm
Aborted (core dumped)
regehr@john-home:~/alive2-regehr/build$