https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105384
Bug ID: 105384 Summary: compilation never (?) finishes with __builtin_yn{,f,l} at -O and above Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: compile-time-hog Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Created attachment 52874 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52874&action=edit reduced testcase I don't know if this should be reported against gcc or libmpfr. Compiler output: $ x86_64-pc-linux-gnu-gcc -O testcase.c -wrapper gdb,-q,--args Reading symbols from /repo/gcc-trunk/binary-trunk-r12-8242-20220425114659-gf0e170f72f8-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.1/cc1... r (gdb) r Starting program: /repo/gcc-trunk/binary-trunk-r12-8242-20220425114659-gf0e170f72f8-checking-yes-rtl-df-extra-nobootstrap-amd64/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/cc1 -quiet -iprefix /repo/gcc-trunk/binary-trunk-r12-8242-20220425114659-gf0e170f72f8-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../lib/gcc/x86_64-pc-linux-gnu/12.0.1/ testcase.c -quiet -dumpdir a- -dumpbase testcase.c -dumpbase-ext .c -mtune=generic -march=x86-64 -O -o /tmp/ccIIYJf7.s [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". ^C Program received signal SIGINT, Interrupt. 0x00007ffff7c8ee22 in __gmpn_mul_1 () from /usr/lib64/libgmp.so.10 (gdb) bt #0 0x00007ffff7c8ee22 in __gmpn_mul_1 () from /usr/lib64/libgmp.so.10 #1 0x00000000000155b7 in ?? () #2 0x00007ffff7c8503a in __gmpz_mul_ui () from /usr/lib64/libgmp.so.10 #3 0x00007ffff7d3964f in mpfr_yn () from /usr/lib64/libmpfr.so.6 #4 0x000000000100fe4a in do_mpfr_arg2 (result=result@entry=0x7fffffffc360, func=0x643db0 <mpfr_yn@plt>, arg0=..., arg1=arg1@entry=0x7ffff7836260, format=format@entry=0x26bb4c0 <ieee_double_format>) at /repo/gcc-trunk/gcc/fold-const-call.cc:232 #5 0x0000000001012573 in do_mpfr_arg2 (format=0x26bb4c0 <ieee_double_format>, arg1=0x7ffff7836260, arg0=..., func=<optimized out>, result=0x7fffffffc360) at /repo/gcc-trunk/gcc/fold-const-call.cc:222 #6 fold_const_call_sss (format=0x26bb4c0 <ieee_double_format>, arg1=0x7ffff7836260, arg0=..., fn=CFN_BUILT_IN_YN, result=0x7fffffffc360) at /repo/gcc-trunk/gcc/fold-const-call.cc:1466 #7 fold_const_call_1 (fn=CFN_BUILT_IN_YN, type=0x7ffff770c348, arg0=0x7ffff7708438, arg1=<optimized out>) at /repo/gcc-trunk/gcc/fold-const-call.cc:1562 #8 0x0000000000e4ab9b in fold_builtin_2 (arg1=0x7ffff7833450, arg0=0x7ffff7708438, fndecl=0x7ffff778c800, expr=0x0, loc=254475) at /repo/gcc-trunk/gcc/builtins.cc:9376 #9 fold_builtin_n (loc=254475, expr=0x0, fndecl=0x7ffff778c800, args=<optimized out>, nargs=<optimized out>) at /repo/gcc-trunk/gcc/builtins.cc:9540 #10 0x0000000000fdcf3b in fold_build_call_array_loc (loc=loc@entry=254475, type=0x7ffff770c348, fn=fn@entry=0x7ffff7836220, nargs=nargs@entry=2, argarray=argarray@entry=0x7ffff7821d50) at /repo/gcc-trunk/gcc/fold-const.cc:13965 #11 0x0000000000d52b40 in build_function_call_vec (loc=<optimized out>, arg_loc=..., function=<optimized out>, params=<optimized out>, origtypes=<optimized out>, orig_fundecl=<optimized out>) at /repo/gcc-trunk/gcc/tree.h:3572 #12 0x0000000000d74094 in c_parser_postfix_expression_after_primary (parser=0x7ffff76f7b40, expr_loc=254475, expr=...) at /repo/gcc-trunk/gcc/c/c-parser.cc:10560 #13 0x0000000000d6b3e1 in c_parser_postfix_expression (parser=<optimized out>) at /repo/gcc-trunk/gcc/c/c-parser.cc:10234 #14 0x0000000000d6f8eb in c_parser_unary_expression (parser=0x7ffff76f7b40) at /repo/gcc-trunk/gcc/c/c-parser.cc:8261 #15 0x0000000000d71082 in c_parser_cast_expression (parser=0x7ffff76f7b40, after=0x0) at /repo/gcc-trunk/gcc/c/c-parser.cc:8103 #16 0x0000000000d712ef in c_parser_binary_expression (parser=0x7ffff76f7b40, after=0x0, omp_atomic_lhs=0x0) at /repo/gcc-trunk/gcc/c/c-parser.cc:7906 #17 0x0000000000d7277c in c_parser_conditional_expression (parser=0x7ffff76f7b40, after=<optimized out>, omp_atomic_lhs=0x0) at /repo/gcc-trunk/gcc/c/c-parser.cc:7606 #18 0x0000000000d72fa1 in c_parser_expr_no_commas (parser=0x7ffff76f7b40, after=<optimized out>, omp_atomic_lhs=<optimized out>) at /repo/gcc-trunk/gcc/c/c-parser.cc:7521 #19 0x0000000000d73212 in c_parser_expression (parser=0x7ffff76f7b40) at /repo/gcc-trunk/gcc/c/c-parser.cc:10697 #20 0x0000000000d73979 in c_parser_expression_conv (parser=0x7ffff76f7b40) at /repo/gcc-trunk/gcc/c/c-parser.cc:10736 #21 0x0000000000d68958 in c_parser_statement_after_labels (parser=0x7ffff76f7b40, if_p=0x0, chain=0x0) at /repo/gcc-trunk/gcc/c/c-parser.cc:6263 #22 0x0000000000d6af3b in c_parser_compound_statement_nostart (parser=0x7ffff76f7b40) at /repo/gcc-trunk/gcc/c/c-parser.cc:5800 #23 0x0000000000d8ae86 in c_parser_compound_statement (parser=parser@entry=0x7ffff76f7b40, endlocp=endlocp@entry=0x7fffffffd280) at /repo/gcc-trunk/gcc/c/c-parser.cc:5609 #24 0x0000000000d8c909 in c_parser_declaration_or_fndef (parser=0x7ffff76f7b40, fndef_ok=<optimized out>, static_assert_ok=<optimized out>, empty_ok=<optimized out>, nested=<optimized out>, start_attr_ok=<optimized out>, objc_foreach_object_declaration=<optimized out>, omp_declare_simd_clauses=<optimized out>, have_attrs=<optimized out>, attrs=<optimized out>, oacc_routine_data=<optimized out>, fallthru_attr_p=<optimized out>) at /repo/gcc-trunk/gcc/c/c-parser.cc:2544 #25 0x0000000000d94a54 in c_parser_external_declaration (parser=0x7ffff76f7b40) at /repo/gcc-trunk/gcc/c/c-parser.cc:1779 #26 0x0000000000d9549c in c_parser_translation_unit (parser=<optimized out>) at /repo/gcc-trunk/gcc/c/c-parser.cc:1652 #27 c_parse_file () at /repo/gcc-trunk/gcc/c/c-parser.cc:23357 #28 0x0000000000df6c8e in c_common_parse_file () at /repo/gcc-trunk/gcc/c-family/c-opts.cc:1240 #29 0x00000000013a3ede in compile_file () at /repo/gcc-trunk/gcc/toplev.cc:452 #30 0x0000000000d0528e in do_compile (no_backend=false) at /repo/gcc-trunk/gcc/toplev.cc:2168 #31 toplev::main (this=this@entry=0x7fffffffd57e, argc=<optimized out>, argc@entry=17, argv=<optimized out>, argv@entry=0x7fffffffd6c8) at /repo/gcc-trunk/gcc/toplev.cc:2320 #32 0x0000000000d071cf in main (argc=17, argv=0x7fffffffd6c8) at /repo/gcc-trunk/gcc/main.cc:39 The execution doesn't seem to ever finish. $ x86_64-pc-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-8242-20220425114659-gf0e170f72f8-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --disable-bootstrap --with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld --with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-r12-8242-20220425114659-gf0e170f72f8-checking-yes-rtl-df-extra-nobootstrap-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 12.0.1 20220425 (experimental) (GCC)