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

            Bug ID: 124785
           Summary: [module] ICE Regression in find_dependencies
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marcel at laverdet dot com
  Target Milestone: ---

Created attachment 64145
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64145&action=edit
reproduction

The attached reproduction is about 80 lines of code, chopped down from v8's
include sources. The build is provided by cmake. I couldn't nail down exactly
what it is about this that's causing the problem. The platform is aarch64 Linux
via macOS Docker.

Works fine on gcc 15.2.0:

root[19:06:19] [/workspace/packages/third_party/v8] $ rm -rf build && cmake -G
Ninja -B build && ninja -C build google_v8
-- The CXX compiler identification is GNU 15.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
CMake Warning (dev) at
/usr/share/cmake-4.3/Modules/Compiler/CMakeCommonCompilerMacros.cmake:226
(cmake_language):
  CMake's support for `import std;` in C++23 and newer is experimental.  It
  is meant only for experimentation and feedback to CMake developers.
Call Stack (most recent call first):
  /usr/share/cmake-4.3/Modules/CMakeDetermineCompilerSupport.cmake:110
(cmake_cxx_find_modules_json)
  /usr/share/cmake-4.3/Modules/CMakeTestCXXCompiler.cmake:83
(CMAKE_DETERMINE_COMPILER_SUPPORT)
  CMakeLists.txt:6 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting CXX compile features - done
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /workspace/packages/third_party/v8/build
ninja: Entering directory `build'
[8/8] Linking CXX static library libgoogle_v8.a

-----------------------

Does not work in trunk

root[19:05:59] [/workspace/packages/third_party/v8] $ rm -rf build &&
CC=/root/gcc-16/bin/gcc CXX=/root/gcc-16/bin/g++ cmake -G Ninja -B build &&
ninja -C build google_v8
-- The CXX compiler identification is GNU 16.0.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /root/gcc-16/bin/g++ - skipped
-- Detecting CXX compile features
CMake Warning (dev) at
/usr/share/cmake-4.3/Modules/Compiler/CMakeCommonCompilerMacros.cmake:226
(cmake_language):
  CMake's support for `import std;` in C++23 and newer is experimental.  It
  is meant only for experimentation and feedback to CMake developers.
Call Stack (most recent call first):
  /usr/share/cmake-4.3/Modules/CMakeDetermineCompilerSupport.cmake:110
(cmake_cxx_find_modules_json)
  /usr/share/cmake-4.3/Modules/CMakeTestCXXCompiler.cmake:83
(CMAKE_DETERMINE_COMPILER_SUPPORT)
  CMakeLists.txt:6 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Detecting CXX compile features - done
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /workspace/packages/third_party/v8/build
ninja: Entering directory `build'
[7/8] Building CXX object CMakeFiles/google_v8.dir/v8.cc.o
FAILED: [code=1] CMakeFiles/google_v8.dir/v8.cc.o
CMakeFiles/google_v8.dir/v8.gcm 
/root/gcc-16/bin/g++   -std=c++26 -MD -MT CMakeFiles/google_v8.dir/v8.cc.o -MF
CMakeFiles/google_v8.dir/v8.cc.o.d -fmodules-ts
-fmodule-mapper=CMakeFiles/google_v8.dir/v8.cc.o.modmap -MD
-fdeps-format=p1689r5 -x c++ -o CMakeFiles/google_v8.dir/v8.cc.o -c
/workspace/packages/third_party/v8/v8.cc
/workspace/packages/third_party/v8/v8.cc:1:8: internal compiler error: in
decl_value, at cp/module.cc:8410
    1 | export module v8;
      |        ^~~~~~
0x26d01f3 internal_error(char const*, ...)
        /gcc-out/../gcc/gcc/diagnostic-global-context.cc:787
0x88a747 fancy_abort(char const*, int, char const*)
        /gcc-out/../gcc/gcc/diagnostics/context.cc:1813
0xa8965b decl_value
        /gcc-out/../gcc/gcc/cp/module.cc:8410
0xa952c7 depset::hash::find_dependencies(module_state*)
        /gcc-out/../gcc/gcc/cp/module.cc:15641
0xa965c7 module_state::write_begin(elf_out*, cpp_reader*, module_state_config&,
unsigned int&)
        /gcc-out/../gcc/gcc/cp/module.cc:21004
0xa97f2f finish_module_processing(cpp_reader*)
        /gcc-out/../gcc/gcc/cp/module.cc:23855
0x9eef03 c_parse_final_cleanups()
        /gcc-out/../gcc/gcc/cp/decl2.cc:6122
0xd3c0b7 c_common_parse_file()
        /gcc-out/../gcc/gcc/c-family/c-opts.cc:1448
/root/gcc-16/libexec/gcc/aarch64-unknown-linux-gnu/16.0.1/cc1plus -quiet
-imultiarch aarch64-linux-gnu -MD CMakeFiles/google_v8.dir/v8.cc.d -MF
CMakeFiles/google_v8.dir/v8.cc.o.d -MT CMakeFiles/google_v8.dir/v8.cc.o
-D_GNU_SOURCE /workspace/packages/third_party/v8/v8.cc
-fdeps-file=CMakeFiles/google_v8.dir/v8.cc.ddi
-fdeps-target=CMakeFiles/google_v8.dir/v8.cc.o -quiet -dumpdir
CMakeFiles/google_v8.dir/ -dumpbase v8.cc.cc -dumpbase-ext .cc -mlittle-endian
-mabi=lp64 -std=c++26 -fmodules
-fmodule-mapper=CMakeFiles/google_v8.dir/v8.cc.o.modmap -fdeps-format=p1689r5
-o /tmp/cc9ghRQg.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
ninja: build stopped: subcommand failed.

Reply via email to