armv7 lang/gcc12 "no bootstrap" build via system clang 15.0.7 based poudriere build ends up stuck in a small loop

From: Mark Millard <marklmi_at_yahoo.com>
Date: Mon, 06 Mar 2023 08:46:45 UTC
Under main that has clang 15.0.7, I've had to locally
switch to using the likes of:

OPTIONS_DEFAULT_armv7=STANDARD_BOOTSTRAP

(to express it in Makefile terms) for lang/gcc12 in order
to avoid the following.

The no bootstrap build ends up stuck in small loop in partition_union
(in cc1):

(gdb) info threads
  Id   Target Id                   Frame 
* 1    LWP 632886 of process 27787 0x016eb82c in partition_union ()
(gdb) bt
#0  0x016eb82c in partition_union ()
#1  0x0133e6ec in var_union(_var_map*, tree_node*, tree_node*) ()
#2  0x013218e4 in attempt_coalesce(_var_map*, ssa_conflicts*, int, int, __sFILE*) ()
#3  0x013203d0 in coalesce_ssa_name(_var_map*) ()
#4  0x012c66b4 in rewrite_out_of_ssa(ssaexpand*) ()
#5  0x0082c094 in (anonymous namespace)::pass_expand::execute(function*) ()
#6  0x00fd6ff0 in execute_one_pass(opt_pass*) ()
#7  0x00fd8380 in execute_pass_list_1(opt_pass*) ()
#8  0x00fc6df0 in execute_pass_list(function*, opt_pass*) ()
#9  0x00880c20 in cgraph_node::expand() ()
#10 0x00882d10 in symbol_table::compile() ()
#11 0x00883454 in symbol_table::finalize_compilation_unit() ()
#12 0x0120e204 in compile_file() ()
#13 0x0120d9d4 in toplev::main(int, char**) ()
#14 0x01646c28 in main ()
(gdb) finish
Run till exit from #0  0x016eb82c in partition_union ()

It never exits. I've walked through the short loop that ends
up with data that leads to no progress: bne always taken and
reaches a status of no change in the values involved happens
in the loop.

truss shows no output and no subroutines are called in the
few instruction long loop.

I ran multiple tests of "no bootstrap" and all failed the
same way.

Such would not be a good thing for the FreeBSD armv7 package
build server.

Also seen via lldb:

(lldb) bt
* thread #1, name = 'cc1', stop reason = signal SIGSTOP
  * frame #0: 0x016eb82c cc1`partition_union + 152
    frame #1: 0x0133e6ec cc1`var_union(_var_map*, tree_node*, tree_node*) + 104
    frame #2: 0x013218e4 cc1`attempt_coalesce(_var_map*, ssa_conflicts*, int, int, __sFILE*) + 508
    frame #3: 0x013203d0 cc1`coalesce_ssa_name(_var_map*) + 7240
    frame #4: 0x012c66b4 cc1`rewrite_out_of_ssa(ssaexpand*) + 2020
    frame #5: 0x0082c094 cc1`(anonymous namespace)::pass_expand::execute(function*) + 68
    frame #6: 0x00fd6ff0 cc1`execute_one_pass(opt_pass*) + 616
    frame #7: 0x00fd8380 cc1`execute_pass_list_1(opt_pass*) + 44
    frame #8: 0x00fc6df0 cc1`execute_pass_list(function*, opt_pass*) + 40
    frame #9: 0x00880c20 cc1`cgraph_node::expand() + 324
    frame #10: 0x00882d10 cc1`symbol_table::compile() + 3860
    frame #11: 0x00883454 cc1`symbol_table::finalize_compilation_unit() + 300
    frame #12: 0x0120e204 cc1`compile_file() + 236
    frame #13: 0x0120d9d4 cc1`toplev::main(int, char**) + 7028
    frame #14: 0x01646c28 cc1`main + 48
    frame #15: 0x004ad3f0 cc1`__start(argc=31, argv=0xffffadec, env=0xffffae6c, ps_strings=<unavailable>, obj=0x4181e004, cleanup=0x417ed4d8) at crt1_c.c:92:7


The armv7 STANDARD_BOOTSTRAP change lead to it reaching completion.

But the "no bootstrap" issue suggests that system-clang 15.0.7
has a problem for armv7 targeting. (I've not seen problems for
targeting aarch64 or amd64.)


For reference:

# uname -apKU
FreeBSD CA72_16Gp_ZFS 14.0-CURRENT FreeBSD 14.0-CURRENT #88 main-n261230-e78dc78e517a-dirty: Wed Mar  1 16:17:45 PST 2023     root@CA72_16Gp_ZFS:/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/sys/GENERIC-NODBG-CA72 arm armv7 1400081 1400081

via:

# poudriere jail -l
JAILNAME          VERSION         ARCH          METHOD TIMESTAMP           PATH
. . .
main-CA7          14.0-CURRENT    arm.armv7     null   2021-06-27 17:58:33 /usr/obj/DESTDIRs/main-CA7-poud
. . .

on an aarch64 system, no qemu involved (or even installed):

# uname -apKU
FreeBSD CA72_16Gp_ZFS 14.0-CURRENT FreeBSD 14.0-CURRENT #88 main-n261230-e78dc78e517a-dirty: Wed Mar  1 16:17:45 PST 2023     root@CA72_16Gp_ZFS:/usr/obj/BUILDs/main-CA72-nodbg-clang/usr/main-src/arm64.aarch64/sys/GENERIC-NODBG-CA72 arm64 aarch64 1400081 1400081

(It is a 16 Cortex-A72 HoneyComb.)

===
Mark Millard
marklmi at yahoo.com