Skip to content

Segfault with gcc 15 and -O2 #2340

@vbraun

Description

@vbraun

Describe the bug

The testsuite for fmpz_mpoly_factor fails when building on gcc 15 when compiling with optimization level -O2 or greater.

Steps to reproduce

$ make distclean && CFLAGS='-O2 -g' ./configure && make -j10 && make -j10 check MOD=fmpz_mpoly_factor
[...]
  CC  fmpz_mpoly_factor/test/main.c
fmpz_mpoly_factor_squarefree...
fmpz_mpoly_factor...
fmpz_mpoly_factor_gcd_brown...
fmpz_mpoly_factor_gcd_zippel...
fmpz_mpoly_factor_zassenhaus...
fmpz_poly_pfrac...
fmpz_mpoly_factor_gcd_subresultant...
fmpz_mpoly_factor_squarefree                      0.02   (PASS)
fmpz_mpoly_factor_wang...
fmpz_mpoly_factor                                 0.04   (PASS)
fmpz_mpoly_factor_content...
fmpz_mpoly_factor_gcd_subresultant                0.05   (PASS)
fmpz_mpoly_factor_gcd_zippel2...
FAIL:
factor is reducible
fmpz_mpoly_factor_content                         0.03   (PASS)
fmpz_mpoly_factor_gcd_zippel                      0.16   (PASS)
fmpz_mpoly_factor_lcc_kaltofen...
fmpz_mpoly_factor_lcc_kaltofen                    0.01   (PASS)
fmpz_mpoly_factor_zassenhaus                      0.23   (PASS)
fmpz_mpoly_factor_zippel...
fmpz_poly_pfrac                                   0.23   (PASS)
FAIL:
factor is reducible
make: *** [Makefile:790: build/fmpz_mpoly_factor/test/main_TEST_RUN_2] Aborted (core dumped)
make: *** Waiting for unfinished jobs....
fmpz_mpoly_factor_gcd_zippel2                     0.25   (PASS)
fmpz_mpoly_factor_gcd_brown                       0.61   (PASS)
fmpz_mpoly_factor_gcd_brown_threaded...

Expected behavior
Tests currently succeed with -O1, expected would be the same with -O2:

$ make distclean && CFLAGS='-O1 -g' ./configure && make -j10 && make -j10 check MOD=fmpz_mpoly_factor
[...]
  CC  fmpz_mpoly_factor/test/main.c
fmpz_mpoly_factor_zassenhaus...
fmpz_mpoly_factor...
fmpz_mpoly_factor_squarefree...
fmpz_mpoly_factor_gcd_brown...
fmpz_mpoly_factor_gcd_subresultant...
fmpz_poly_pfrac...
fmpz_mpoly_factor_gcd_zippel...
fmpz_mpoly_factor_squarefree                      0.02   (PASS)
fmpz_mpoly_factor_wang...
fmpz_mpoly_factor                                 0.04   (PASS)
fmpz_mpoly_factor_content...
fmpz_mpoly_factor_gcd_subresultant                0.06   (PASS)
fmpz_mpoly_factor_gcd_zippel2...
fmpz_mpoly_factor_content                         0.03   (PASS)
fmpz_mpoly_factor_gcd_zippel                      0.17   (PASS)
fmpz_mpoly_factor_lcc_kaltofen...
fmpz_mpoly_factor_lcc_kaltofen                    0.01   (PASS)
fmpz_mpoly_factor_wang                            0.19   (PASS)
fmpz_poly_pfrac                                   0.24   (PASS)
fmpz_mpoly_factor_zassenhaus                      0.24   (PASS)
fmpz_mpoly_factor_zippel...
fmpz_mpoly_factor_gcd_zippel2                     0.25   (PASS)
fmpz_mpoly_factor_zippel                          0.13   (PASS)
fmpz_mpoly_factor_gcd_brown                       0.63   (PASS)
fmpz_mpoly_factor_gcd_brown_threaded...
fmpz_mpoly_factor_gcd_brown_threaded              0.11   (PASS)

All tests passed for fmpz_mpoly_factor.

System (please complete the following information):

  • System CPU: AMD Ryzen 9 7900X (Fedora 42)
  • Version of FLINT (if using Git, please specify commit): 3.2.2, 3.3.0, and 94b262d
  • How FLINT was configured (i.e. options pushed): CFLAGS='-O2 -g' ./configure
  • Output of configure
    checking build system type... zen4-pc-linux-gnu
    checking host system type... zen4-pc-linux-gnu
    checking how to print strings... printf
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables... 
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether the compiler supports GNU C... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to enable C11 features... none needed
    checking for a sed that does not truncate output... /usr/bin/sed
    checking for grep that handles long lines and -e... /usr/bin/grep
    checking for egrep... /usr/bin/grep -E
    checking for fgrep... /usr/bin/grep -F
    checking for ld used by gcc... ld
    checking if the linker (ld) is GNU ld... yes
    checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
    checking the name lister (/usr/bin/nm -B) interface... BSD nm
    checking whether ln -s works... yes
    checking the maximum length of command line arguments... 1572864
    checking how to convert zen4-pc-linux-gnu file names to zen4-pc-linux-gnu format... func_convert_file_noop
    checking how to convert zen4-pc-linux-gnu file names to toolchain format... func_convert_file_noop
    checking for ld option to reload object files... -r
    checking for file... file
    checking for objdump... objdump
    checking how to recognize dependent libraries... pass_all
    checking for dlltool... no
    checking how to associate runtime and link libraries... printf %s\n
    checking for ranlib... ranlib
    checking for archiver @FILE support... @
    checking for strip... strip
    checking for gawk... gawk
    checking command to parse /usr/bin/nm -B output from gcc object... ok
    checking for sysroot... no
    checking for a working dd... /usr/bin/dd
    checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
    checking for mt... no
    checking if : is a manifest tool... no
    checking for stdio.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for strings.h... yes
    checking for sys/stat.h... yes
    checking for sys/types.h... yes
    checking for unistd.h... yes
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if gcc supports -fno-rtti -fno-exceptions... no
    checking for gcc option to produce PIC... -fPIC -DPIC
    checking if gcc PIC flag -fPIC -DPIC works... yes
    checking if gcc static flag -static works... no
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (ld) supports shared libraries... yes
    checking whether -lc should be explicitly linked in... no
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... no
    checking for a race-free mkdir -p... /usr/bin/mkdir -p
    checking how to run the C preprocessor... gcc -E
    checking if compiler is GCC... yes
    checking if compiler is Clang... no
    checking for inline... inline
    checking whether byte ordering is bigendian... no
    checking if memory is strongly-ordered... yes
    checking for gmp.h... yes
    checking if version of GMP is greater than 6.2.1... yes
    checking if GMP defines mp_limb_t as unsigned long long int... no
    checking for mpfr.h... yes
    checking if version of MPFR is greater than 4.1.0... yes
    checking for desired ABI... 64
    checking for stdarg.h... yes
    checking for math.h... yes
    checking for float.h... yes
    checking for errno.h... yes
    checking for fenv.h... yes
    checking for alloca.h... yes
    checking for malloc.h... yes
    checking for sys/param.h... yes
    checking for windows.h... no
    checking for pthread_np.h... no
    checking for pthread.h... yes
    checking for library containing atan2... -lm
    checking for library containing __gmpz_init... -lgmp
    checking for library containing __gmpn_mul_basecase... none required
    checking for library containing __gmpn_gcd_11... none required
    checking for library containing __gmpn_div_q... none required
    checking for library containing __gmpn_invert_limb... none required
    checking for library containing __gmpn_modexact_1_odd... no
    checking for library containing __gmpn_addmul_2... none required
    checking for library containing __gmpn_add_n_sub_n... none required
    checking for library containing __gmpn_add_nc... no
    checking for library containing __gmpn_sub_nc... no
    checking for library containing __gmpn_addlsh1_n... none required
    checking for library containing __gmpn_addlsh1_n_ip1... no
    checking for library containing __gmpn_rsh1sub_n... none required
    checking for library containing __gmpn_rsh1add_n... none required
    checking for library containing mpfr_init... -lmpfr
    checking for library containing mpfr_round_p... none required
    checking for library containing mpfr_mulhigh_n... none required
    checking for library containing mpfr_sqrhigh_n... none required
    checking whether gcc accepts -pthread... yes
    checking if cpu_set_t is supported... yes
    checking if alloca works... yes
    checking for aligned_alloc... yes
    checking for _aligned_malloc... no
    checking whether gcc accepts -g -O2 -g... yes
    checking for immintrin.h... yes
    checking if system have required x86_64 instruction set for fft_small... no
    checking if system can use FLINT's fft_small module... no
    checking for suitable m4... m4
    checking whether assembler supports --noexecstack option... yes
    checking how to switch to text section... .text
    checking how to switch to data section... .data
    checking for assembler label suffix... :
    checking for assembler global directive... .globl
    checking for assembler global directive attribute... 
    checking if globals are prefixed by underscore... no
    checking how to switch to read-only data section... 	.section	.rodata
    checking for assembler .type directive... .type	$1,@$2
    checking for assembler .size directive... .size	$1,$2
    checking for assembler local label prefix... .L
    checking for assembler byte directive... .byte
    checking if .align assembly directive is logarithmic... no
    checking if the .align directive accepts an 0x90 fill in .text... yes
    checking for assembler COFF type directives... no
    creating config.m4
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating flint.pc
    config.status: creating src/flint.h
    config.status: creating src/config.h
    config.status: creating src/flint-config.h
    config.status: linking src/gmpcompat.h.in to src/gmpcompat.h
    config.status: linking src/mpn_extras/x86_64/zen4/flint-mparam.h to src/flint-mparam.h
    config.status: linking src/fmpz/link/fmpz_single.c to src/fmpz/fmpz.c
    config.status: executing libtool commands
    

Additional context

Related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions