[Bug 2052797] [NEW] Internal Compiler Error in cxx_eval_call_expression with C++20 Modules and constexpr Expansion and inputs may not also have inputs

Vandson Eduardo Dantas silva 2052797 at bugs.launchpad.net
Fri Feb 9 11:50:18 UTC 2024


Public bug reported:

I encountered an internal compiler error (ICE) while building a C++
project using C++20 modules. The error occurs during the compilation of
a constructor that involves `constexpr` expansion of
`std::__cxx11::basic_string<char>`. The issue seems related to the
handling of `constexpr` expressions and module imports.

Environment:
- Compiler: GCC 12 (also with GCC 13)
- OS: Ubuntu 22.04 (WSL), also with normal Ubuntu
- Build System: CMake with Ninja generator

Error Message:
[ 29%] Building CXX object src/CMakeFiles/canary_lib.dir/Unity/unity_21_cxx.cxx.o
In module imported at /home/ubuntu/canary/src/lua/lua_definitions.hpp:12:1,
...
included from /home/ubuntu/canary/src/server/signals.cpp:12,
from /home/ubuntu/canary/build/src/CMakeFiles/canary_lib.dir/Unity/unity_21_cxx.cxx:4:
game_movement: note: unable to represent further imported source locations
...
/home/ubuntu/canary/src/creatures/interactions/chat.hpp:85:51: internal compiler error: in cxx_eval_call_expression, at cp/constexpr.cc:2836
85 | ChatChannel(channelId, channelName) { }
| ^
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See file:///usr/share/doc/gcc-12/README.Bugs for instructions.

Steps to Reproduce:
1. Compile the project using GCC 12 with C++20 modules enabled.
2. Observe the internal compiler error during the `constexpr` expansion in the constructor.

Expected Behavior:
The compiler should handle `constexpr` expansions without crashing, especially in the context of C++20 modules.

Actual Behavior:
The compiler crashes with an internal compiler error, indicating a potential issue in `cxx_eval_call_expression` related to `constexpr` expansion and module handling.

Additional Context:
- The error seems to be triggered by a specific interaction between C++20 modules and `constexpr` expansions.
- I have attempted to isolate the problem to a minimal example but found that it specifically occurs in the context of our project's structure and module imports.

Please let me know if additional information or a minimal reproducible
example is needed to investigate this issue further. Thank you for your
assistance in addressing this compiler bug.

The project I'm testing is this:
https://github.com/opentibiabr/canary/pull/2189

The steps to the error:
Generate a cache: cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/vcpkg/scripts/buildsystems/vcpkg.cmake
Compile: cmake --build build

I encountered another issue as well, related to inputs, which occurs when I compile using cmakepresets. If I compile without it, I encounter the constexpr issue mentioned earlier. The other error I'm referring to is as follows:
[1/44] Building CXX object src/CMakeFiles/ModulesLib.dir/game/info/light_info.ixx.o
FAILED: src/CMakeFiles/ModulesLib.dir/game/info/light_info.ixx.o
/usr/bin/c++  -I/home/runner/work/canary/canary/build/vcpkg_installed/x64-linux/include/mysql -flto=auto -flto=auto -O3 -DNDEBUG -std=gnu++20 -flto=auto -fno-fat-lto-objects -fPIC -fmodules-ts -x c++ -Wno-deprecated-declarations -fopenmp -MD -MT src/CMakeFiles/ModulesLib.dir/game/info/light_info.ixx.o -MF src/CMakeFiles/ModulesLib.dir/game/info/light_info.ixx.o.d -o src/CMakeFiles/ModulesLib.dir/game/info/light_info.ixx.o -c /home/runner/work/canary/canary/src/game/info/light_info.ixx
inputs may not also have inputs[2/44] Building CXX object src/CMakeFiles/ModulesLib.dir/enums/enum_modules.ixx.o

The project I'm testing is this: https://github.com/opentibiabr/canary/pull/2189
GitHub Actions error: https://github.com/opentibiabr/canary/actions/runs/7839809013/job/21393442847?pr=2189

The steps to the error:
Generate a cache: cmake -DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/vcpkg/scripts/buildsystems/vcpkg.cmake .. --preset Linux-release
Compile: cmake --build Linux-release

** Affects: gcc-12 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-12 in Ubuntu.
https://bugs.launchpad.net/bugs/2052797

Title:
  Internal Compiler Error in cxx_eval_call_expression with C++20 Modules
  and constexpr Expansion and inputs may not also have inputs

Status in gcc-12 package in Ubuntu:
  New

Bug description:
  I encountered an internal compiler error (ICE) while building a C++
  project using C++20 modules. The error occurs during the compilation
  of a constructor that involves `constexpr` expansion of
  `std::__cxx11::basic_string<char>`. The issue seems related to the
  handling of `constexpr` expressions and module imports.

  Environment:
  - Compiler: GCC 12 (also with GCC 13)
  - OS: Ubuntu 22.04 (WSL), also with normal Ubuntu
  - Build System: CMake with Ninja generator

  Error Message:
  [ 29%] Building CXX object src/CMakeFiles/canary_lib.dir/Unity/unity_21_cxx.cxx.o
  In module imported at /home/ubuntu/canary/src/lua/lua_definitions.hpp:12:1,
  ...
  included from /home/ubuntu/canary/src/server/signals.cpp:12,
  from /home/ubuntu/canary/build/src/CMakeFiles/canary_lib.dir/Unity/unity_21_cxx.cxx:4:
  game_movement: note: unable to represent further imported source locations
  ...
  /home/ubuntu/canary/src/creatures/interactions/chat.hpp:85:51: internal compiler error: in cxx_eval_call_expression, at cp/constexpr.cc:2836
  85 | ChatChannel(channelId, channelName) { }
  | ^
  Please submit a full bug report, with preprocessed source (by using -freport-bug).
  Please include the complete backtrace with any bug report.
  See file:///usr/share/doc/gcc-12/README.Bugs for instructions.

  Steps to Reproduce:
  1. Compile the project using GCC 12 with C++20 modules enabled.
  2. Observe the internal compiler error during the `constexpr` expansion in the constructor.

  Expected Behavior:
  The compiler should handle `constexpr` expansions without crashing, especially in the context of C++20 modules.

  Actual Behavior:
  The compiler crashes with an internal compiler error, indicating a potential issue in `cxx_eval_call_expression` related to `constexpr` expansion and module handling.

  Additional Context:
  - The error seems to be triggered by a specific interaction between C++20 modules and `constexpr` expansions.
  - I have attempted to isolate the problem to a minimal example but found that it specifically occurs in the context of our project's structure and module imports.

  Please let me know if additional information or a minimal reproducible
  example is needed to investigate this issue further. Thank you for
  your assistance in addressing this compiler bug.

  The project I'm testing is this:
  https://github.com/opentibiabr/canary/pull/2189

  The steps to the error:
  Generate a cache: cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/vcpkg/scripts/buildsystems/vcpkg.cmake
  Compile: cmake --build build

  I encountered another issue as well, related to inputs, which occurs when I compile using cmakepresets. If I compile without it, I encounter the constexpr issue mentioned earlier. The other error I'm referring to is as follows:
  [1/44] Building CXX object src/CMakeFiles/ModulesLib.dir/game/info/light_info.ixx.o
  FAILED: src/CMakeFiles/ModulesLib.dir/game/info/light_info.ixx.o
  /usr/bin/c++  -I/home/runner/work/canary/canary/build/vcpkg_installed/x64-linux/include/mysql -flto=auto -flto=auto -O3 -DNDEBUG -std=gnu++20 -flto=auto -fno-fat-lto-objects -fPIC -fmodules-ts -x c++ -Wno-deprecated-declarations -fopenmp -MD -MT src/CMakeFiles/ModulesLib.dir/game/info/light_info.ixx.o -MF src/CMakeFiles/ModulesLib.dir/game/info/light_info.ixx.o.d -o src/CMakeFiles/ModulesLib.dir/game/info/light_info.ixx.o -c /home/runner/work/canary/canary/src/game/info/light_info.ixx
  inputs may not also have inputs[2/44] Building CXX object src/CMakeFiles/ModulesLib.dir/enums/enum_modules.ixx.o

  The project I'm testing is this: https://github.com/opentibiabr/canary/pull/2189
  GitHub Actions error: https://github.com/opentibiabr/canary/actions/runs/7839809013/job/21393442847?pr=2189

  The steps to the error:
  Generate a cache: cmake -DCMAKE_TOOLCHAIN_FILE=/home/ubuntu/vcpkg/scripts/buildsystems/vcpkg.cmake .. --preset Linux-release
  Compile: cmake --build Linux-release

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-12/+bug/2052797/+subscriptions




More information about the foundations-bugs mailing list