NetBSD Problem Report #60843

From www@netbsd.org  Sat Oct  3 06:24:54 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 3693B1A923C
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  3 Oct 2026 06:24:54 +0000 (UTC)
Message-Id: <20261003062452.26FA41A923E@mollari.NetBSD.org>
Date: Sat,  3 Oct 2026 06:24:52 +0000 (UTC)
From: rokuyama.rk@gmail.com
Reply-To: rokuyama.rk@gmail.com
To: gnats-bugs@NetBSD.org
Subject: GCC/alpha 14 miscompiles GCC backend
X-Send-Pr-Version: www-1.0
X-From4GNATS: "rokuyama.rk@gmail.com via gnats" <gnats-admin@NetBSD.org>

>Number:         60843
>Category:       toolchain
>Synopsis:       GCC/alpha 14 miscompiles GCC backend
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          analyzed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 03 06:25:00 +0000 2026
>Closed-Date:    
>Last-Modified:  Mon Oct 12 01:00:02 +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:
For alpha, GCC 14 crashes during various pkgsrc's.

I've found that this is because GCC 14 miscompiles its backend.

(1) pkgtools/libnbcompat

```
ds10% cd /build/pkgsrc/pkgtools/libnbcompat/work.alpha/libnbcompat-20251029/
ds10% gcc  -D__DBINTERFACE_PRIVATE -I. -I.  -O2 -mieee -DHAVE_CONFIG_H -c glob.c
during GIMPLE pass: vrp
In file included from glob.c:12:
__glob13.c: In function 'globextend':
__glob13.c:798:1: internal compiler error: Illegal instruction
  798 | globextend(path, pglob, limit)
      | ^~~~~~~~~~
0x12151bbff diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag*, diagnostic_t)
        ???:0
0x12151c2eb internal_error(char const*, ...)
        ???:0
0x120353613 crash_signal(int)
        ???:0
0x12185efd4 omp_clause_num_ops
        ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <http://www.NetBSD.org/support/send-pr.html> for instructions.
```

This can be worked around by adding

```
COPTS.gimple-range-phi.cc+= -O1
```

to external/gpl3/gcc/usr.bin/backend/Makefile.

(2) devel/libtool-base

```
ds10% cd /build/pkgsrc/devel/libtool-base/work.alpha/libtool-2.4.7/
ds10% gcc -DHAVE_CONFIG_H -I. -DLTDLOPEN=libltdlc "-DLT_CONFIG_H=<config.h>" -DLTDL -I. -I. -Ilibltdl -I./libltdl -Ilibltdl/libltdl -I./libltdl/libltdl -I/usr/include -O2 -mieee -I/usr/include -MT libltdl/libltdlc_la-ltdl.lo -MD -MP -MF libltdl/.deps/libltdlc_la-ltdl.Tpo -c libltdl/ltdl.c  -fPIC -DPIC -o libltdl/.libs/libltdlc_la-ltdl.o
during GIMPLE pass: strlen
libltdl/ltdl.c: In function 'lt_dlsym':
libltdl/ltdl.c:2013:1: internal compiler error: Segmentation fault
 2013 | lt_dlsym (lt_dlhandle place, const char *symbol)
      | ^~~~~~~~
0x12151ba7f diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag*, diagnostic_t)
        ???:0
0x12151c16b internal_error(char const*, ...)
        ???:0
0x120353613 crash_signal(int)
        ???:0
0x1210eb0b8 maybe_invalidate(gimple*, bool)
        ???:0
0x1210ff84b strlen_pass::check_and_optimize_stmt(bool*)
        ???:0
0x1210ffce7 strlen_pass::before_dom_children(basic_block_def*)
        ???:0
0x1206d73bb dom_walker::walk(basic_block_def*)
        ???:0
0x1211002f7 (anonymous namespace)::printf_strlen_execute(function*, bool)
        ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <http://www.NetBSD.org/support/send-pr.html> for instructions.
```

This can be worked around by adding -O1 to
tree-ssa-tail-merge.cc and tree-ssa-thread{backward,edge}.cc.

(3) devel/gettext-tools

```
ds10% cd /build/pkgsrc/devel/gettext-tools/work.alpha/gettext-1.0/gettext-tools/src
ds10% gcc -DLOCALEDIR=\"/usr/pkg/share/locale\"  -DUSEJAVA=0  -DGETTEXTJAR=\"/usr/pkg/share/gettext\"\"/gettext.jar\"  -DBINDIR=\"/usr/pkg/bin\"  -DLIBDIR=\"/usr/pkg/lib\"  -DLIBEXECDIR=\"/usr/pkg/libexec\"  -DGETTEXTDATADIR=\"/usr/pkg/share/gettext\"  -DPROJECTSDIR=\"/usr/pkg/share/gettext\"\"/projects\"  -DEXEEXT=\"\" -DHAVE_CONFIG_H -I. -I..  -I..  -I../tree-sitter-0.23.2/lib/include  -I../libgrep -I../libgrep  -I../gnulib-lib -I../gnulib-lib  -I../../gettext-runtime/intl -I../../gettext-runtime/intl -DINSTALLDIR=\"/usr/pkg/bin\" -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.13 -mieee   -O2 -mieee -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.13 -MT msginit-msgl-merge.o -MD -MP -MF .deps/msginit-msgl-merge.Tpo -c -o msginit-msgl-merge.o `test -f 'msgl-merge.c' || echo './'`msgl-merge.c
during GIMPLE pass: strlen
msgl-merge.c: In function 'message_merge':
msgl-merge.c:316:1: internal compiler error: Segmentation fault
  316 | message_merge (message_ty *def, message_ty *ref, bool force_fuzzy,
      | ^~~~~~~~~~~~~
0x12151a12f diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag*, diagnostic_t)
        ???:0
0x12151a81b internal_error(char const*, ...)
        ???:0
0x120353613 crash_signal(int)
        ???:0
0x1208ea8a0 fold_convert_loc(unsigned int, tree_node*, tree_node*)
        ???:0
0x1210f9a43 strlen_pass::handle_builtin_strcpy(built_in_function)
        ???:0
0x1210fe0db strlen_pass::check_and_optimize_call(bool*)
        ???:0
0x1210fef0b strlen_pass::check_and_optimize_stmt(bool*)
        ???:0
0x1210ff3e7 strlen_pass::before_dom_children(basic_block_def*)
        ???:0
0x1206d73bb dom_walker::walk(basic_block_def*)
        ???:0
0x1210ff9f7 (anonymous namespace)::printf_strlen_execute(function*, bool)
        ???:0
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <http://www.NetBSD.org/support/send-pr.html> for instructions.
```

This can be worked around by adding -O1 to tree-ssa-strlen.cc.

With -O1 hacks for (1)--(3), more than 270 random pkgsrc's successfully
build on alpha with GCC 14.

Note that lang/ruby-3[34] and ruby-40 still fail to build. But for this
case, cc1 does not crash unlike (1)--(3). These cannot be worked around by
adding any optimization flags to GCC backend. Instead, compiling some ruby
source with -O1 works around the problem.

Also note that unlike
PR toolchain/60842 GCC/alpha 14 miscompiles libgcc btree_insert()
-fno-tree-loop-distribute-patterns is insufficient for this purpose.
>How-To-Repeat:
Described above.
>Fix:
Described above.

>Release-Note:

>Audit-Trail:
From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60843 CVS commit: src/external/gpl3/gcc/usr.bin/backend
Date: Sat, 3 Oct 2026 06:29:56 +0000

 Module Name:	src
 Committed By:	rin
 Date:		Sat Oct  3 06:29:56 UTC 2026

 Modified Files:
 	src/external/gpl3/gcc/usr.bin/backend: Makefile

 Log Message:
 gcc: backend: Sprinkle -O1 to some files for alpha

 With this workaround, more than 270 pkgsrc's successfully build for me.

 PR toolchain/60843 GCC/alpha 14 miscompiles GCC backend


 To generate a diff of this commit:
 cvs rdiff -u -r1.84 -r1.85 src/external/gpl3/gcc/usr.bin/backend/Makefile

 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/60843 CVS commit: src/external/gpl3/gcc
Date: Sat, 3 Oct 2026 06:34:59 +0000

 Module Name:	src
 Committed By:	rin
 Date:		Sat Oct  3 06:34:59 UTC 2026

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

 Log Message:
 README.gcc14: Now, alpha runs at a same level as GCC12

 PR toolchain/60843 GCC/alpha 14 miscompiles GCC backend


 To generate a diff of this commit:
 cvs rdiff -u -r1.34 -r1.35 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:46 +0000
State-Changed-Why:
Problem worked around.


From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60843 CVS commit: pkgsrc/lang
Date: Sat, 3 Oct 2026 11:12:34 +0000

 Module Name:	pkgsrc
 Committed By:	rin
 Date:		Sat Oct  3 11:12:34 UTC 2026

 Modified Files:
 	pkgsrc/lang/ruby33: hacks.mk
 	pkgsrc/lang/ruby34: hacks.mk
 	pkgsrc/lang/ruby40: hacks.mk

 Log Message:
 ruby*: Works around GCC 14 bug on alpha

 s/-O2/-O1/ for GCC >= 14 on alpha. Otherwise, for ruby34, e.g.,

 ```
 gcc -mieee -O2 -mieee -pthread -I/usr/include -I/usr/pkg/include -fPIC -pipe  -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -I. -I.ext/include/alpha-netbsd -I.ext/include -I./include -I. -I./prism -I./enc/unicode/15.0.0   -Dmodular_gc_dir="" -I/usr/include -I/usr/pkg/include    -o ractor.o -c ractor.c
 during RTL pass: sched2
 ractor.c: In function 'ractor_channel_func':
 ractor.c:4010:1: internal compiler error: in move_insn, at haifa-sched.cc:5477
  4010 | }
       | ^
 0x1215184ff diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag*, diagnostic_t)
         ???:0
 0x121518beb internal_error(char const*, ...)
         ???:0
 0x121640d9b fancy_abort(char const*, int, char const*)
         ???:0
 0x120569693 move_insn(rtx_insn*, rtx_insn*, rtx_def*)
         ???:0
 0x12057ef93 schedule_block(basic_block_def**, void*)
         ???:0
 0x1212bc327 schedule_insns() [clone .part.0]
         ???:0
 0x1212bc907 (anonymous namespace)::pass_sched2::execute(function*)
         ???:0
 Please submit a full bug report, with preprocessed source (by using -freport-bug).
 Please include the complete backtrace with any bug report.
 See <http://www.NetBSD.org/support/send-pr.html> for instructions.
 ```

 cf. PR toolchain/60843 GCC/alpha 14 miscompiles GCC backend


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.2 pkgsrc/lang/ruby33/hacks.mk
 cvs rdiff -u -r1.1 -r1.2 pkgsrc/lang/ruby34/hacks.mk
 cvs rdiff -u -r1.1 -r1.2 pkgsrc/lang/ruby40/hacks.mk

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

From: "Maya Rashish" <maya@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60843 CVS commit: [pkgsrc-2026Q3] pkgsrc/lang
Date: Mon, 12 Oct 2026 00:55:16 +0000

 Module Name:	pkgsrc
 Committed By:	maya
 Date:		Mon Oct 12 00:55:16 UTC 2026

 Modified Files:
 	pkgsrc/lang/ruby33 [pkgsrc-2026Q3]: hacks.mk
 	pkgsrc/lang/ruby34 [pkgsrc-2026Q3]: hacks.mk
 	pkgsrc/lang/ruby40 [pkgsrc-2026Q3]: hacks.mk

 Log Message:
 Pullup ticket #7265 - requested by rin
 lang/ruby34: Bug fix
 lang/ruby33: Bug fix
 lang/ruby40: Bug fix

 Revisions pulled up:
 - lang/ruby33/hacks.mk                                          1.2
 - lang/ruby34/hacks.mk                                          1.2
 - lang/ruby40/hacks.mk                                          1.2

 ---
    Module Name:	pkgsrc
    Committed By:	rin
    Date:		Sat Oct  3 11:12:34 UTC 2026

    Modified Files:
    	pkgsrc/lang/ruby33: hacks.mk
    	pkgsrc/lang/ruby34: hacks.mk
    	pkgsrc/lang/ruby40: hacks.mk

    Log Message:
    ruby*: Works around GCC 14 bug on alpha

    s/-O2/-O1/ for GCC >= 14 on alpha. Otherwise, for ruby34, e.g.,

    ```
    gcc -mieee -O2 -mieee -pthread -I/usr/include -I/usr/pkg/include -fPIC
    -pipe  -fno-strict-overflow -fvisibility=hidden
    -fexcess-precision=standard -DRUBY_EXPORT -I.
    -I.ext/include/alpha-netbsd -I.ext/include -I./include -I. -I./prism
    -I./enc/unicode/15.0.0   -Dmodular_gc_dir="" -I/usr/include
    -I/usr/pkg/include    -o ractor.o -c ractor.c
    during RTL pass: sched2
    ractor.c: In function 'ractor_channel_func':
    ractor.c:4010:1: internal compiler error: in move_insn, at
    haifa-sched.cc:5477
      4010 | }
           | ^
    0x1215184ff diagnostic_impl(rich_location*, diagnostic_metadata const*,
    int, char const*, __va_list_tag*, diagnostic_t)
             ???:0
    0x121518beb internal_error(char const*, ...)
             ???:0
    0x121640d9b fancy_abort(char const*, int, char const*)
             ???:0
    0x120569693 move_insn(rtx_insn*, rtx_insn*, rtx_def*)
             ???:0
    0x12057ef93 schedule_block(basic_block_def**, void*)
             ???:0
    0x1212bc327 schedule_insns() [clone .part.0]
             ???:0
    0x1212bc907 (anonymous namespace)::pass_sched2::execute(function*)
             ???:0
    Please submit a full bug report, with preprocessed source (by using
    -freport-bug).
    Please include the complete backtrace with any bug report.
    See <http://www.NetBSD.org/support/send-pr.html> for instructions.
    ```

    cf. PR toolchain/60843 GCC/alpha 14 miscompiles GCC backend


 To generate a diff of this commit:
 cvs rdiff -u -r1.1 -r1.1.22.1 pkgsrc/lang/ruby33/hacks.mk
 cvs rdiff -u -r1.1 -r1.1.14.1 pkgsrc/lang/ruby34/hacks.mk
 cvs rdiff -u -r1.1 -r1.1.6.1 pkgsrc/lang/ruby40/hacks.mk

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

>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.