google / fully-homomorphic-encryption

An FHE compiler for C++
Apache License 2.0
3.51k stars 252 forks source link

Using Yosys with arrays of struct appears to cause segfault #22

Closed davidbrucecousins closed 2 years ago

davidbrucecousins commented 2 years ago

the following system runs for cleartext, openfhe, interpreted_openfhe, but yosys_interpreted_openfhe causes a segfault

when run with a debugger gives the following backtrace Thread 1 "bug_yosys_inter" received signal SIGSEGV, Segmentation fault. gnu_cxx::atomic_add_dispatch (val=1, mem=0xea) at /usr/include/c++/9/ext/atomicity.h:96 96 atomic_add(mem, __val); (gdb) bt

0 __gnu_cxx::atomic_add_dispatch (val=1, __mem=0xea)

at /usr/include/c++/9/ext/atomicity.h:96

1 std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_add_ref_copy (

this=0xe2) at /usr/include/c++/9/bits/shared_ptr_base.h:139

2 std::shared_count<(__gnu_cxx::_Lock_policy)2>::operator= (r=...,

this=0x555555bb1020) at /usr/include/c++/9/bits/shared_ptr_base.h:747

3 std::__shared_ptr<lbcrypto::LWECiphertextImpl, (__gnu_cxx::_Lock_policy)2>::operator= (this=0x555555bb1018)

at /usr/include/c++/9/bits/shared_ptr_base.h:1080

4 std::shared_ptr::operator= (

this=0x555555bb1018) at /usr/include/c++/9/bits/shared_ptr.h:103

5 fully_homomorphic_encryption::transpiler::YosysOpenFheRunner::YosysOpenFheRunnerState::Run (this=0x555555bcc850, result=..., in_args=...,

inout_args=std::vector of length 1, capacity 1 = {...})
at transpiler/yosys_openfhe_runner.cc:310

6 0x00005555555c82d4 in fully_homomorphic_encryption::transpiler::YosysOpenFheRunner::Run (this=, result=...,

in_args=std::vector of length 3, capacity 3 = {...}, 
inout_args=std::vector of length 1, capacity 1 = {...}, cc=...)
at /usr/include/c++/9/bits/stl_uninitialized.h:82

7 0x000055555558d3bc in select_struct_UNSAFE(absl::Span<std::shared_ptr const>, absl::Span<std::shared_ptr const>, absl::Span<std::shared_ptr const>, absl::Span<std::shared_ptr >, lbcrypto::BinFHEContext) () at /usr/include/c++/9/bits/stl_tree.h:211

8 0x0000555555589de8 in select_struct(OpenFheArrayRef<BugStruct, 2u>, OpenFheRef, OpenFheRef, OpenFheRef, lbcrypto::BinFHEContext) () at /usr/include/c++/9/bits/stl_tree.h:211

9 0x0000555555582e0b in main () at /usr/include/c++/9/ext/new_allocator.h:89

(gdb) bug.zip

Cam2337 commented 2 years ago

Closed with 6c169ff291a0002b128993ee3d876dc9d91d909c.