crash on __gmpz_init

Vincent Lefevre vincent at vinc17.net
Mon Jan 22 11:51:21 CET 2024


On 2024-01-22 11:02:21 +0100, Marc Glisse wrote:
> Hello,
> 
>   mpz_class M[LINES][COLS];
> 
> you are trying to put an array with millions of elements on the stack, so
> the stack overflows. Very large arrays need to be allocated on the heap in
> C++ (new, malloc, or some wrapper like std::vector).

Note that the user has a segmentation fault in __gmpz_init for
test2_mem.c too (tc_7000x5000), which uses malloc(). See the
gdb output.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-bugs mailing list