NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/60843: GCC/alpha 14 miscompiles GCC backend



>Number:         60843
>Category:       toolchain
>Synopsis:       GCC/alpha 14 miscompiles GCC backend
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 03 06:25:00 +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.




Home | Main Index | Thread Index | Old Index