[Bug c++/100490] New: gcc 11.1.0 hangs forever while building its own libstdc++ (c++17 floating_from_chars.cc) on aarch64 linux

bero at lindev dot ch gcc-bugzilla@gcc.gnu.org
Sun May 9 02:28:17 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100490

            Bug ID: 100490
           Summary: gcc 11.1.0 hangs forever while building its own
                    libstdc++ (c++17 floating_from_chars.cc) on aarch64
                    linux
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bero at lindev dot ch
  Target Milestone: ---

Building gcc 11.1.0 on aarch64 hangs forever while building libstdc++, in the
c++17 version of floating_from_chars.cc.

/home/bero/abf/gcc/BUILD/gcc-11.1.0/obj-aarch64-openmandriva-linux-gnu/./gcc/xgcc
-shared-libgcc
-B/home/bero/abf/gcc/BUILD/gcc-11.1.0/obj-aarch64-openmandriva-linux-gnu/./gcc
-nostdinc++
-L/home/bero/abf/gcc/BUILD/gcc-11.1.0/obj-aarch64-openmandriva-linux-gnu/aarch64-openmandriva-linux-gnu/libstdc++-v3/src
-L/home/bero/abf/gcc/BUILD/gcc-11.1.0/obj-aarch64-openmandriva-linux-gnu/aarch64-openmandriva-linux-gnu/libstdc++-v3/src/.libs
-L/home/bero/abf/gcc/BUILD/gcc-11.1.0/obj-aarch64-openmandriva-linux-gnu/aarch64-openmandriva-linux-gnu/libstdc++-v3/libsupc++/.libs
-B/usr/aarch64-openmandriva-linux-gnu/bin/
-B/usr/aarch64-openmandriva-linux-gnu/lib/ -isystem
/usr/aarch64-openmandriva-linux-gnu/include -isystem
/usr/aarch64-openmandriva-linux-gnu/sys-include -fno-checking
-I/home/bero/abf/gcc/BUILD/gcc-11.1.0/libstdc++-v3/../libgcc
-I/home/bero/abf/gcc/BUILD/gcc-11.1.0/obj-aarch64-openmandriva-linux-gnu/aarch64-openmandriva-linux-gnu/libstdc++-v3/include/aarch64-openmandriva-linux-gnu
-I/home/bero/abf/gcc/BUILD/gcc-11.1.0/obj-aarch64-openmandriva-linux-gnu/aarch64-openmandriva-linux-gnu/libstdc++-v3/include
-I/home/bero/abf/gcc/BUILD/gcc-11.1.0/libstdc++-v3/libsupc++ -std=gnu++17
-D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -Wwrite-strings
-Wcast-qual -Wabi=2 -fdiagnostics-show-location=once -ffunction-sections
-fdata-sections -frandom-seed=floating_from_chars.lo -fimplicit-templates -g
-O2 -D_GNU_SOURCE -c
../../../../../libstdc++-v3/src/c++17/floating_from_chars.cc  -fPIC -DPIC
-D_GLIBCXX_SHARED -o floating_from_chars.o
[at this point, gcc hangs forever with cc1plus eating 100% CPU]

The same version builds fine on a x86_64 (even as an x86_64 to aarch64
crosscompiler).

The problem goes away if I force -O0 instead of -O2 (-O1 still hangs forever).

Attaching gdb to the cc1plus process results in

#0  0x0000ffff913cd6b4 in __gmpn_add_n () from /usr/lib64/libgmp.so.10
#1  0x0000ffff913d6ce8 in __gmpz_add () from /usr/lib64/libgmp.so.10
#2  0x0000ffff91498dd8 in mpfr_exp_2 () from /usr/lib64/libmpfr.so.6
#3  0x0000ffff9147c2d0 in mpfr_exp () from /usr/lib64/libmpfr.so.6
#4  0x0000ffff91488500 in mpfr_pow_general () from /usr/lib64/libmpfr.so.6
#5  0x0000ffff91489604 in mpfr_pow () from /usr/lib64/libmpfr.so.6
#6  0x0000000001038260 in do_mpfr_arg2 (result=0xffffd973d0b8, func=0xa6a950
<mpfr_pow@plt>, arg0=0xffff8d968cc0, arg1=0xffff8d968da0, format=0x26107a8
<ieee_single_format>) at ../../gcc/fold-const-call.c:202
#7  0x0000000001038cf0 in fold_const_pow (result=0xffffd973d0b8,
arg0=0xffff8d968cc0, arg1=0xffff8d968da0, format=0x26107a8
<ieee_single_format>) at ../../gcc/fold-const-call.c:504
#8  0x000000000103b8b0 in fold_const_call_sss (result=0xffffd973d0b8,
fn=CFN_BUILT_IN_POWF, arg0=0xffff8d968cc0, arg1=0xffff8d968da0,
format=0x26107a8 <ieee_single_format>) at ../../gcc/fold-const-call.c:1396
#9  0x000000000103bd14 in fold_const_call_1 (fn=CFN_BUILT_IN_POWF,
type=0xffff904342a0, arg0=0xffff8d964828, arg1=0xffff8d9648b8) at
../../gcc/fold-const-call.c:1516
#10 0x000000000103c8b4 in fold_const_call (fn=CFN_BUILT_IN_POWF,
type=0xffff904342a0, arg0=0xffff8d964828, arg1=0xffff8d9648b8) at
../../gcc/fold-const-call.c:1681
#11 0x0000000000e1f0b0 in fold_builtin_2 (loc=2147490302, expr=0x0,
fndecl=0xffff904a5a00, arg0=0xffff8d964828, arg1=0xffff8d9648b8) at
../../gcc/builtins.c:12000
#12 0x0000000000e1f6d4 in fold_builtin_n (loc=2147490302, expr=0x0,
fndecl=0xffff904a5a00, args=0xffffd973d370, nargs=2) at
../../gcc/builtins.c:12163
#13 0x0000000000e1fd08 in fold_builtin_call_array (loc=2147490302,
fn=0xffff8ef8b460, n=2, argarray=0xffffd973d370) at ../../gcc/builtins.c:12299
#14 0x0000000000ab2ac0 in cxx_eval_builtin_function_call (ctx=0xffffd973d9e0,
t=0xffff8ef6af40, fun=0xffff904a5a00, lval=false,
non_constant_p=0xffffd973e97f, overflow_p=0xffffd973e97e)
    at ../../gcc/cp/constexpr.c:1433
#15 0x0000000000ab515c in cxx_eval_call_expression (ctx=0xffffd973d9e0,
t=0xffff8ef6af40, lval=false, non_constant_p=0xffffd973e97f,
overflow_p=0xffffd973e97e) at ../../gcc/cp/constexpr.c:2363
#16 0x0000000000ac0020 in cxx_eval_constant_expression (ctx=0xffffd973d9e0,
t=0xffff8ef6af40, lval=false, non_constant_p=0xffffd973e97f,
overflow_p=0xffffd973e97e, jump_target=0x0)
    at ../../gcc/cp/constexpr.c:6218
#17 0x0000000000abda20 in cxx_eval_store_expression (ctx=0xffffd973e180,
t=0xffff8ef885f0, lval=false, non_constant_p=0xffffd973e97f,
overflow_p=0xffffd973e97e) at ../../gcc/cp/constexpr.c:5230
#18 0x0000000000ac055c in cxx_eval_constant_expression (ctx=0xffffd973e180,
t=0xffff8ef885f0, lval=false, non_constant_p=0xffffd973e97f,
overflow_p=0xffffd973e97e, jump_target=0x0)
    at ../../gcc/cp/constexpr.c:6327
#19 0x0000000000ac05c4 in cxx_eval_constant_expression (ctx=0xffffd973e180,
t=0xffff8ef8b440, lval=false, non_constant_p=0xffffd973e97f,
overflow_p=0xffffd973e97e, jump_target=0xffffd973e3d0)
    at ../../gcc/cp/constexpr.c:6339
#20 0x0000000000ac077c in cxx_eval_constant_expression (ctx=0xffffd973e180,
t=0xffff8ef8b420, lval=false, non_constant_p=0xffffd973e97f,
overflow_p=0xffffd973e97e, jump_target=0xffffd973e3d0)
    at ../../gcc/cp/constexpr.c:6396
#21 0x0000000000abef18 in cxx_eval_statement_list (ctx=0xffffd973e180,
t=0xffff8ef8b2e0, non_constant_p=0xffffd973e97f, overflow_p=0xffffd973e97e,
jump_target=0xffffd973e3d0) at ../../gcc/cp/constexpr.c:5788
#22 0x0000000000ac1780 in cxx_eval_constant_expression (ctx=0xffffd973e310,
t=0xffff8ef8b2e0, lval=false, non_constant_p=0xffffd973e97f,
overflow_p=0xffffd973e97e, jump_target=0xffffd973e3d0)
    at ../../gcc/cp/constexpr.c:6868
#23 0x0000000000ab65d8 in cxx_eval_call_expression (ctx=0xffffd973e860,
t=0xffff8d945740, lval=false, non_constant_p=0xffffd973e97f,
overflow_p=0xffffd973e97e) at ../../gcc/cp/constexpr.c:2764
#24 0x0000000000ac0020 in cxx_eval_constant_expression (ctx=0xffffd973e860,
t=0xffff8d945740, lval=false, non_constant_p=0xffffd973e97f,
overflow_p=0xffffd973e97e, jump_target=0x0)
    at ../../gcc/cp/constexpr.c:6218
#25 0x0000000000ac2a8c in cxx_eval_outermost_constant_expr (t=0xffff8d945740,
allow_non_constant=true, strict=true, manifestly_const_eval=false,
constexpr_dtor=false, object=0x0)
    at ../../gcc/cp/constexpr.c:7251
#26 0x0000000000ac35d0 in maybe_constant_value (t=0xffff8d945740, decl=0x0,
manifestly_const_eval=false) at ../../gcc/cp/constexpr.c:7525
#27 0x0000000000af40d4 in cp_fold (x=0xffff8d945740) at
../../gcc/cp/cp-gimplify.c:2594
#28 0x0000000000af2c14 in cp_fold_maybe_rvalue (x=0xffff8d945700, rval=true) at
../../gcc/cp/cp-gimplify.c:2109
#29 0x0000000000af2ce8 in cp_fold_rvalue (x=0xffff8d945700) at
../../gcc/cp/cp-gimplify.c:2132
#30 0x0000000000af2db8 in cp_fully_fold (x=0xffff8d945700) at
../../gcc/cp/cp-gimplify.c:2156
#31 0x0000000000af2dfc in cp_fully_fold_init (x=0xffff8d945700) at
../../gcc/cp/cp-gimplify.c:2167
#32 0x0000000000d193fc in store_init_value (decl=0xffff8d963ab0,
init=0xffff8d945700, cleanups=0xffffd973ed00, flags=0) at
../../gcc/cp/typeck2.c:816
#33 0x0000000000b1c6cc in check_initializer (decl=0xffff8d963ab0,
init=0xffff8d945700, flags=0, cleanups=0xffffd973ed00) at
../../gcc/cp/decl.c:7080
#34 0x0000000000b1f34c in cp_finish_decl (decl=0xffff8d963ab0,
init=0xffff8d945700, init_const_expr_p=true, asmspec_tree=0x0, flags=0) at
../../gcc/cp/decl.c:8014
#35 0x0000000000c8cfe8 in tsubst_expr (t=0xffff8e963fa0, args=0xffff8da8c740,
complain=3, in_decl=0xffff8e950880, integral_constant_expression_p=false) at
../../gcc/cp/pt.c:18432
#36 0x0000000000c8c528 in tsubst_expr (t=0xffff8e957800, args=0xffff8da8c740,
complain=3, in_decl=0xffff8e950880, integral_constant_expression_p=false) at
../../gcc/cp/pt.c:18238
#37 0x0000000000c8d778 in tsubst_expr (t=0xffff8e95b600, args=0xffff8da8c740,
complain=3, in_decl=0xffff8e950880, integral_constant_expression_p=false) at
../../gcc/cp/pt.c:18589
#38 0x0000000000ca085c in instantiate_body (pattern=0xffff8e950880,
args=0xffff8da8c740, d=0xffff8da8d000, nested_p=false) at
../../gcc/cp/pt.c:25909
#39 0x0000000000ca1300 in instantiate_decl (d=0xffff8da8d000, defer_ok=false,
expl_inst_class_mem_p=false) at ../../gcc/cp/pt.c:26203
#40 0x0000000000ca1574 in instantiate_pending_templates (retries=0) at
../../gcc/cp/pt.c:26282
#41 0x0000000000b4a224 in c_parse_final_cleanups () at
../../gcc/cp/decl2.c:4962
#42 0x0000000000da0508 in c_common_parse_file () at
../../gcc/c-family/c-opts.c:1240
#43 0x000000000146562c in compile_file () at ../../gcc/toplev.c:457
#44 0x000000000146962c in do_compile () at ../../gcc/toplev.c:2201
#45 0x00000000014699ec in toplev::main (this=0xffffd973f938, argc=55,
argv=0xffffd973fa88) at ../../gcc/toplev.c:2340
#46 0x000000000246896c in main (argc=55, argv=0xffffd973fa88) at
../../gcc/main.c:39


Related libraries:
gmp 6.2.1
mpfr 4.1.0-P12
mpc 1.2.1
isl 0.24
(each of those passed "make check").


More information about the Gcc-bugs mailing list