Re: 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: Wed, 08 Mar 2023 00:35:55 UTC
[I got a openSUSE tumblweed linux going on a RPi2 v1.1
(so: armv7) and installed clang 15. I show the test
fails there as well.]

On Mar 7, 2023, at 04:04, Mark Millard <marklmi@yahoo.com> wrote:

> On Mar 7, 2023, at 03:45, Dimitry Andric <dim@FreeBSD.org> wrote:
> 
>> On 7 Mar 2023, at 11:26, Mark Millard <marklmi@yahoo.com> wrote:
>>> 
>>> Below is a small example C source showing the clang 15+ armv7
>>> problem that leads to the unbounded looping in later code in
>>> the lang/gcc12+ builds: a data structure is mis-initialized,
>>> breaking its invariant properties used by the later code
>>> structure.
>> ...
>>> In the output below, note the blocks of 4 "next"
>>> values that do not change. Each should match the
>>> earlier hexadecimal value on the same line: point
>>> back to same element of the array. 3 of 4 do not.
>>> 
>>> # cc -g -O2 partition.c
>>> # ./a.out
>>> 0: 0x40a84 : next?: 0x40a84
>>> 1: 0x40a90 : next?: 0x40a84
>>> 2: 0x40a9c : next?: 0x40a84
>>> 3: 0x40aa8 : next?: 0x40a84
>> 
>> Very strange, I don't see this at all here. All the values are always
>> correct, at every optimization level. I tried clang 13, clang 14, clang
>> 15 from base and clang 15 from ports. However, my architecture is amd64,
>> so maybe you are running into a armv7 specific issue?
>> 
> 
> Yep: aarch64 and amd64 gcc builds all worked fine
> via system-clang 15 and the test case also works
> fine in my context on those. (All platforms
> have FreeBSD built from copies of the same
> source code.)
> 
> It is only on armv7 that I got the gcc build
> problems and the test case failures.
> 
> FYI:
> 
> aarch64 Fedora 37 using clang-15 also works
> fine for me (only tried the test case, not
> gcc builds):
> 
> # clang-15      -g -O2 partition.c ; ./a.out
> 0: 0x420038 : next?: 0x420038
> 1: 0x420048 : next?: 0x420048
> 2: 0x420058 : next?: 0x420058
> 3: 0x420068 : next?: 0x420068
> 4: 0x420078 : next?: 0x420078
> 5: 0x420088 : next?: 0x420088
> 6: 0x420098 : next?: 0x420098
> 7: 0x4200a8 : next?: 0x4200a8
> 8: 0x4200b8 : next?: 0x4200b8
> 9: 0x4200c8 : next?: 0x4200c8
> 10: 0x4200d8 : next?: 0x4200d8
> 11: 0x4200e8 : next?: 0x4200e8
> 12: 0x4200f8 : next?: 0x4200f8
> 13: 0x420108 : next?: 0x420108
> 14: 0x420118 : next?: 0x420118
> 15: 0x420128 : next?: 0x420128
> 16: 0x420138 : next?: 0x420138
> 17: 0x420148 : next?: 0x420148
> 18: 0x420158 : next?: 0x420158
> 19: 0x420168 : next?: 0x420168
> 20: 0x420178 : next?: 0x420178
> 21: 0x420188 : next?: 0x420188
> 22: 0x420198 : next?: 0x420198
> 23: 0x4201a8 : next?: 0x4201a8
> 24: 0x4201b8 : next?: 0x4201b8
> 25: 0x4201c8 : next?: 0x4201c8
> 26: 0x4201d8 : next?: 0x4201d8
> 27: 0x4201e8 : next?: 0x4201e8
> 28: 0x4201f8 : next?: 0x4201f8
> 29: 0x420208 : next?: 0x420208
> 30: 0x420218 : next?: 0x420218
> 31: 0x420228 : next?: 0x420228
> 
> # clang-15 -v
> clang version 15.0.7 (Fedora 15.0.7-1.fc37)
> Target: aarch64-redhat-linux-gnu
> Thread model: posix
> InstalledDir: /usr/bin
> Found candidate GCC installation: /usr/bin/../lib/gcc/aarch64-redhat-linux/12
> Selected GCC installation: /usr/bin/../lib/gcc/aarch64-redhat-linux/12
> Candidate multilib: .;@m64
> Selected multilib: .;@m64
> 
> If I understand right, Lorenzo indicates that he has
> more failing contexts. I've no evidence of my own of
> such.

# uname -ap
Linux localhost.localdomain 6.2.0-1-lpae #1 SMP Mon Feb 20 06:22:59 UTC 2023 (89e2785) armv7l armv7l armv7l GNU/Linux

# clang-15 -v
clang version 15.0.7
Target: armv7hl-suse-linux-gnueabihf
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/armv7hl-suse-linux-gnueabi/12
Selected GCC installation: /usr/bin/../lib/gcc/armv7hl-suse-linux-gnueabi/12
Candidate multilib: .;@m32
Selected multilib: .;@m32

# clang-15 -g -O2 partition.c ; ./a.out
0: 0x498044 : next?: 0x498044
1: 0x498050 : next?: 0x498044
2: 0x49805c : next?: 0x498044
3: 0x498068 : next?: 0x498044
4: 0x498074 : next?: 0x498074
5: 0x498080 : next?: 0x498074
6: 0x49808c : next?: 0x498074
7: 0x498098 : next?: 0x498074
8: 0x4980a4 : next?: 0x4980a4
9: 0x4980b0 : next?: 0x4980a4
10: 0x4980bc : next?: 0x4980a4
11: 0x4980c8 : next?: 0x4980a4
12: 0x4980d4 : next?: 0x4980d4
13: 0x4980e0 : next?: 0x4980d4
14: 0x4980ec : next?: 0x4980d4
15: 0x4980f8 : next?: 0x4980d4
16: 0x498104 : next?: 0x498104
17: 0x498110 : next?: 0x498104
18: 0x49811c : next?: 0x498104
19: 0x498128 : next?: 0x498104
20: 0x498134 : next?: 0x498134
21: 0x498140 : next?: 0x498134
22: 0x49814c : next?: 0x498134
23: 0x498158 : next?: 0x498134
24: 0x498164 : next?: 0x498164
25: 0x498170 : next?: 0x498164
26: 0x49817c : next?: 0x498164
27: 0x498188 : next?: 0x498164
28: 0x498194 : next?: 0x498194
29: 0x4981a0 : next?: 0x498194
30: 0x4981ac : next?: 0x498194
31: 0x4981b8 : next?: 0x498194

So: Not FreeBSD specific at all.

===
Mark Millard
marklmi at yahoo.com