https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118327

            Bug ID: 118327
           Summary: Internal compiler error in write_unnamed_type_enum in
                    C++ Modules code
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bagishov.mikail at yandex dot ru
  Target Milestone: ---

I have received following ICE

/ # cat /tmp/cciGMAdD.out 
// Target: x86_64-alpine-linux-musl
// Configured with: /home/buildozer/aports/main/gcc/src/gcc-14.2.0/configure
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
--build=x86_64-alpine-linux-musl --host=x86_64-alpine-linux-musl
--target=x86_64-alpine-linux-musl --enable-checking=release --disable-cet
--disable-fixed-point --disable-libstdcxx-pch --disable-multilib --disable-nls
--disable-werror --disable-symvers --enable-__cxa_atexit --enable-default-pie
--enable-default-ssp --enable-languages=c,c++,d,objc,go,fortran,ada
--enable-link-serialization=2 --enable-linker-build-id --disable-libssp
--disable-libsanitizer --enable-shared --enable-threads --enable-tls
--with-bugurl=https://gitlab.alpinelinux.org/alpine/aports/-/issues
--with-system-zlib --with-linker-hash-style=gnu --with-pkgversion='Alpine
14.2.0'
// Thread model: posix
// Supported LTO compression algorithms: zlib
// gcc version 14.2.0 (Alpine 14.2.0) 
// 
// code.c:2:1: warning: global module fragment contents must be from
preprocessor inclusion [-Wglobal-module]
//     2 | template <typename T> void GetReferenceableValue(T);
//       | ^~~~~~~~
// code.c:2:28: warning: 'void GetReferenceableValue(T) [with T = <unnamed
enum>]', declared using an unnamed type, is used but not defined
[-Wc++20-extensions]
//     2 | template <typename T> void GetReferenceableValue(T);
//       |                            ^~~~~~~~~~~~~~~~~~~~~
// code.c: In instantiation of 'void GetReferenceableValue(T) [with T =
<unnamed enum>]':
// code.c:2:28: internal compiler error: in write_unnamed_type_name, at
cp/mangle.cc:1806
// 0x202bae9 internal_error(char const*, ...)
//      ???:0
// 0x72d447 fancy_abort(char const*, int, char const*)
//      ???:0
// 0x80dfd0 mangle_decl(tree_node*)
//      ???:0
// 0x11dee99 decl_assembler_name(tree_node*)
//      ???:0
// 0xa5d48d symbol_table::insert_to_assembler_name_hash(symtab_node*, bool)
//      ???:0
// 0xa751c2 symbol_table::finalize_compilation_unit()
//      ???:0
// Please submit a full bug report, with preprocessed source.
// Please include the complete backtrace with any bug report.
// See <https://gitlab.alpinelinux.org/alpine/aports/-/issues> for
instructions.

// /usr/libexec/gcc/x86_64-alpine-linux-musl/14.2.0/cc1plus -quiet
-D_GNU_SOURCE code.c -quiet -dumpdir a- -dumpbase code.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -fmodules-ts -freport-bug -o - -frandom-seed=0
-fdump-noaddr

# 0 "code.c"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "code.c"
module ;
template <typename T> void GetReferenceableValue(T);
enum { kSooSizeMask };
void set_size() { GetReferenceableValue(kSooSizeMask); }

Compiler was invoked as follows

# gcc -x c++ code.c -fmodules-ts -freport-bug

(Changing file extension or adding -std=c++20/-std=c++23 do not affect the
error)

The same code in Godbolt, if it is more convenient:
https://godbolt.org/z/51oTb94z3


To be clear, I've received error given above when running GCC inside Docker
container.
When running it directly on my host (which is Ubuntu Linux 24.04) with
-freport-bug enabled, I still receive the same error, but then GCC complains
that bug is not reproducible and I should blame my PC instead:

...
The bug is not reproducible, so it is likely a hardware or OS problem.

Given that issue fully reproduces in other two combinations I've tried, I
believe that this is a bug in GCC.

As I see, generated report above already contains most of the relevant
information, so I'll just add a few details.

Compiler version on host:

$ gcc-14 --version
gcc-14 (Ubuntu 14.2.0-4ubuntu2~24.04) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Alpine version (in container):

# cat /etc/os-release 
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.21.1
PRETTY_NAME="Alpine Linux v3.21"
HOME_URL="https://alpinelinux.org/";
BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues";

P.S. This is my first GCC issue, sorry if I did something wrong.

Reply via email to