primesearch / Mlucas

Ⓜ️ Ernst Mayer's Mlucas and Mfactor programs for GIMPS
https://mersenneforum.org/mayer/README.html
GNU General Public License v3.0
8 stars 2 forks source link

Segmentation fault in the "teensy" self-test #7

Open tdulcet opened 8 months ago

tdulcet commented 8 months ago

A segmentation fault occurs in the "teensy" self-test: ./Mlucas -s tt. Here is the output when Mlucas is run in GDB:

INFO: Maximum recommended exponent for FFT length (1 Kdbl) = 22788; p[ = 22679]/pmax_rec = 0.9952167808.
Initial DWT-multipliers chain length = [hiacc] in carry step.
M22679: using FFT length 1K = 1024 8-byte floats, initial residue shift count = 20848
This gives an average   22.147460937500000 bits per digit
Using complex FFT radices        32        16
[New Thread 33016.0x38a4]
mers_mod_square: Init threadpool of 1 threads
executing worker thread id 0, #cores = 12

Thread 5 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 33016.0x38a4]
0x00007ff75b14a060 in radix16_wrapper_square (a=a@entry=0x5b4400, arr_scratch=arr_scratch@entry=0x64a5b0, n=n@entry=1024, radix0=<optimized out>, rt0=0x655c00, rt1=0x655f80, nradices_prim=9, radix_prim=0x7ff75b4f63a0, ws_i=0, ws_j1=736, ws_j2=768, ws_j2_start=992,
    ws_k=30, ws_m=56, ws_blocklen=128, ws_blocklen_sum=128, init_sse2=0, thr_id=14, fwd_fft_only=<optimized out>, c_arr=0x0) at ../src/radix16_wrapper_square.c:1706
1706                    SSE2_RADIX16_CALC_TWIDDLES_LOACC(cc0,add0,add1,rt0,rt1);

Here is the output when Mlucas is compiled with ASan and UBSan enabled:

INFO: Maximum recommended exponent for FFT length (1 Kdbl) = 22788; p[ = 22679]/pmax_rec = 0.9952167808.
Initial DWT-multipliers chain length = [hiacc] in carry step.
M22679: using FFT length 1K = 1024 8-byte floats, initial residue shift count = 20848
This gives an average   22.147460937500000 bits per digit
Using complex FFT radices        32        16
mers_mod_square: Init threadpool of 1 threads
../src/radix16_wrapper_square.c:1679:74: runtime error: left shift of negative value -68424725
../src/radix16_wrapper_square.c:1680:5: runtime error: signed integer overflow: -1094795586 + -1094795586 cannot be represented in type 'int'
../src/radix16_wrapper_square.c:1682:15: runtime error: left shift of negative value -1094795586
../src/radix16_wrapper_square.c:1682:5: runtime error: signed integer overflow: 2105376124 + 2105376124 cannot be represented in type 'int'
../src/radix16_wrapper_square.c:1683:74: runtime error: left shift of negative value -5263441
../src/radix16_wrapper_square.c:1684:15: runtime error: left shift of negative value -1094795586
../src/radix16_wrapper_square.c:1685:74: runtime error: left shift of negative value -10526881
../src/radix16_wrapper_square.c:1686:15: runtime error: left shift of negative value -1094795586
../src/radix16_wrapper_square.c:1687:74: runtime error: left shift of negative value -84215046
../src/radix16_wrapper_square.c:1693:74: runtime error: left shift of negative value -68424725
../src/radix16_wrapper_square.c:1694:5: runtime error: signed integer overflow: -1094795586 + -1094795586 cannot be represented in type 'int'
../src/radix16_wrapper_square.c:1696:15: runtime error: left shift of negative value -1094795586
../src/radix16_wrapper_square.c:1696:5: runtime error: signed integer overflow: 2105376124 + 2105376124 cannot be represented in type 'int'
../src/radix16_wrapper_square.c:1697:74: runtime error: left shift of negative value -5263441
../src/radix16_wrapper_square.c:1698:15: runtime error: left shift of negative value -1094795586
../src/radix16_wrapper_square.c:1699:74: runtime error: left shift of negative value -10526881
../src/radix16_wrapper_square.c:1700:15: runtime error: left shift of negative value -1094795586
../src/radix16_wrapper_square.c:1701:74: runtime error: left shift of negative value -84215046
AddressSanitizer:DEADLYSIGNAL
=================================================================
==442==ERROR: AddressSanitizer: SEGV on unknown address 0x6190bebec4b0 (pc 0x55603ebd9806 bp 0x000000000060 sp 0x7f3218a6e5d0 T1)
==442==The signal is caused by a READ memory access.
    #0 0x55603ebd9806 in radix16_wrapper_square ../src/radix16_wrapper_square.c:1706
    #1 0x55603e78917d in mers_process_chunk ../src/mers_mod_square.c:2258
    #2 0x55603f6f1ba9 in worker_thr_routine ../src/threadpool.c:452
    #3 0x7f321c278b42 in start_thread nptl/pthread_create.c:442
    #4 0x7f321c30a9ff  (/lib/x86_64-linux-gnu/libc.so.6+0x1269ff)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV ../src/radix16_wrapper_square.c:1706 in radix16_wrapper_square
Thread T1 created by T0 here:
    #0 0x7f321cc02685 in __interceptor_pthread_create ../../../../src/libsanitizer/asan/asan_interceptors.cpp:216
    #1 0x55603f6f2edb in threadpool_init ../src/threadpool.c:656

==442==ABORTING