NetBSD Problem Report #60842

From www@netbsd.org  Sat Oct  3 05:57:43 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 6BE7E1A923B
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  3 Oct 2026 05:57:43 +0000 (UTC)
Message-Id: <20261003055741.CF0291A923C@mollari.NetBSD.org>
Date: Sat,  3 Oct 2026 05:57:41 +0000 (UTC)
From: rokuyama.rk@gmail.com
Reply-To: rokuyama.rk@gmail.com
To: gnats-bugs@NetBSD.org
Subject: GCC/alpha 14 miscompiles libgcc btree_insert()
X-Send-Pr-Version: www-1.0
X-From4GNATS: "rokuyama.rk@gmail.com via gnats" <gnats-admin@NetBSD.org>

>Number:         60842
>Category:       toolchain
>Synopsis:       GCC/alpha 14 miscompiles libgcc btree_insert()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          analyzed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 03 06:00:00 +0000 2026
>Closed-Date:    
>Last-Modified:  Sat Oct 03 06:43:19 +0000 2026
>Originator:     Rin Okuyama
>Release:        11.99.8
>Organization:
Internet Initiative Japan Inc.
>Environment:
NetBSD ds10.local 11.99.8 NetBSD 11.99.8 (GENERIC-$Revision: 1.421 $) #0: Tue Sep 29 22:05:52 JST 2026  rin@sakaizumii.local:/home/rin/src/sys/arch/alpha/compile/obj.alpha-alpha/GENERIC alpha
>Description:
With GCC14, tests/usr.bin/c++/*:*pic_profile crash on alpha.
For t_hello:hello_pic_profile:

```
# gdb hello
GNU gdb (GDB) 17.1
...snip...
Reading symbols from hello...
(gdb) r
Starting program: /usr/tests/usr.bin/c++/hello

Program received signal SIGSEGV, Segmentation fault.
0x000003fffde0ea40 in memmove () from ./libtest.so
(gdb) bt
#0  0x000003fffde0ea40 in memmove () from ./libtest.so
#1  0x000003fffdd4ddf0 in btree_insert.isra () from /usr/lib/libgcc_s.so.1
#2  0x000003fffdd4fea8 in __register_frame_info_bases () from /usr/lib/libgcc_s.so.1
#3  0x000003fffdd4ff20 in __register_frame_info () from /usr/lib/libgcc_s.so.1
#4  0x0000000120000ba0 in __do_global_ctors_aux ()
    at /home/rin/src/lib/csu/common/crtbegin.c:84
#5  0x0000000120000738 in _init ()
#6  0x0000000120000968 in ___start (cleanup=<optimized out>,
    ps_strings=0x1ffffffe0) at /home/rin/src/lib/csu/common/crt0-common.c:373
#7  0x00000001200007a8 in _start ()
Backtrace stopped: frame did not save the PC
(gdb)
```

I've found that this is because GCC14 miscompiles btree_insert() itself.
>How-To-Repeat:
Described above.
>Fix:
As a workaround, sprinkle -fno-tree-loop-distribute-patterns to
libgcc/unwind-dw2-btree.h:btree_insert().

Then, all pic_profile tests successfully pass.

>Release-Note:

>Audit-Trail:
From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60842 CVS commit: src/external/gpl3/gcc/dist/libgcc
Date: Sat, 3 Oct 2026 06:04:52 +0000

 Module Name:	src
 Committed By:	rin
 Date:		Sat Oct  3 06:04:52 UTC 2026

 Modified Files:
 	src/external/gpl3/gcc/dist/libgcc: unwind-dw2-btree.h

 Log Message:
 libgcc: btree_insert: Sprinkle -fno-tree-loop-distribute-patterns for alpha

 With this workaround, tests/usr.bin/c++/*:*pic_profile tests successfully
 pass on alpha.

 PR toolchain/60842 GCC/alpha 14 miscompiles libgcc btree_insert()


 To generate a diff of this commit:
 cvs rdiff -u -r1.1.1.1 -r1.2 \
     src/external/gpl3/gcc/dist/libgcc/unwind-dw2-btree.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60842 CVS commit: src/external/gpl3/gcc
Date: Sat, 3 Oct 2026 06:07:02 +0000

 Module Name:	src
 Committed By:	rin
 Date:		Sat Oct  3 06:07:02 UTC 2026

 Modified Files:
 	src/external/gpl3/gcc: README.gcc14

 Log Message:
 README.gcc14: ATF fallouts on alpha have been worked around

 PR toolchain/60842 GCC/alpha 14 miscompiles libgcc btree_insert()


 To generate a diff of this commit:
 cvs rdiff -u -r1.33 -r1.34 src/external/gpl3/gcc/README.gcc14

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->analyzed
State-Changed-By: rin@NetBSD.org
State-Changed-When: Sat, 03 Oct 2026 06:43:19 +0000
State-Changed-Why:
Problem worked around.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.