Closed iljah closed 5 years ago
This program (excluding includes):
int main(int argc, char* argv[]) { std::array<uint64_t, bls::local::keySize> key_data{ 0x1000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000 }; bls::SecretKey secret_key; secret_key.set(key_data.data()); }
segfaults for some reason:
Program received signal SIGSEGV, Segmentation fault. 0x0000000000420300 in mcl::fp::maskArray<unsigned long> (bitSize=18446744073709551615, n=0, x=0x7fffffffd080) at src/fp.cpp:579 579 maskArray(y, op.N, op.bitSize - 1); (gdb) up #1 mcl::fp::copyAndMask (y=y@entry=0x7fffffffd080, x=x@entry=0x7fffffffd040, xByteSize=0, xByteSize@entry=32, op=..., maskMode=<optimized out>, maskMode@entry=mcl::fp::SmallMask) at src/fp.cpp:579 579 maskArray(y, op.N, op.bitSize - 1); (gdb) #2 0x000000000040401e in mcl::FpT<mcl::bn::local::FrTag, 256ul>::setArrayMask<char> (n=n@entry=32, x=x@entry=0x7fffffffd040 "\320xi", this=0x7fffffffd080, this@entry=0x7fffffffd030) at ./../mcl/src/bn_c_impl.hpp:106 106 cast(x)->setArrayMask((const char *)buf, bufSize); (gdb) #3 mclBnFr_setLittleEndian (x=x@entry=0x7fffffffd080, buf=buf@entry=0x7fffffffd060, bufSize=bufSize@entry=32) at ./../mcl/src/bn_c_impl.hpp:106 106 cast(x)->setArrayMask((const char *)buf, bufSize); (gdb) #4 0x000000000040352b in bls::SecretKey::setLittleEndian (bufSize=32, buf=0x7fffffffd060, this=0x7fffffffd080) at submodules/bls/include/bls/bls.hpp:202 202 mclBnFr_setLittleEndian(&self_.v, buf, bufSize); (gdb) #5 bls::SecretKey::set (p=0x7fffffffd060, this=0x7fffffffd080) at submodules/bls/include/bls/bls.hpp:197 197 setLittleEndian(p, local::keySize * sizeof(uint64_t));
at secret_key.set(key_data.data());. What is weird is that identical code works in another larger program. Compiling with GCC 8.1.1 and -O3.
secret_key.set(key_data.data());
Whoops never mind, forgot to bls::init();.
bls::init();
This program (excluding includes):
segfaults for some reason:
at
secret_key.set(key_data.data());
. What is weird is that identical code works in another larger program. Compiling with GCC 8.1.1 and -O3.