`g++-16` C++ modules ICE in inline on Apple Silicon
brew config AND brew doctor output OR brew gist-logs <formula> link
`brew config`:
HOMEBREW_VERSION: 7.0.7-38-g7cce6ea
ORIGIN: https://github.com/Homebrew/brew
HEAD: 7cce6eac8d897b0b8440e16f33dbcb21770da7cf
Last commit: 6 hours ago
Branch: main
Core tap: N/A
Core cask tap: N/A
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_EDITOR: zile
Homebrew Ruby: 4.0.7 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.7/bin/ruby
CPU: 16-core 64-bit arm_palma
Clang: 21.0.0 build 2100
Git: 2.55.0 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 27.0-arm64
CLT: 27.0.0.0.1788430756
Xcode: 27.0
Metal Toolchain: N/A
Rosetta 2: false
`brew doctor`:
Your system is ready to brew.Verification
- My
brew doctoroutput saysYour system is ready to brew.and am still able to reproduce my issue. - I ran
brew updateand am still able to reproduce my issue. - I have resolved all warnings from
brew doctorand that did not fix my problem. - I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.
- My issue is not about a failure to build a formula from source.
- I did not use AI/LLM to create this issue, or I disclosed the tool and model used; I will answer maintainer questions myself without AI/LLM.
What were you trying to do (and why)?
Apologies if this is not the right forum for this issue, but g++ told me to go here.
I was looking into Nvidia's proof-of-concept implementation of C++26' senders/receivers framework (commit eaf8c816, cc @ericniebler). Using the latest available version of g++ from Homebrew (g++-16 (Homebrew GCC 16.2.0) 16.2.0), I tried to compile a simple test example, but instantly got a segfault from the compiler. I managed to reduce the problem to an almost empty file including only the main header.
Compiling on a Linux machine using a homebuilt edition of the same compiler (c++ (Spack GCC) 16.2.0) works. The examples provided with the library also compile without problem.
I have attached the bug report generated by g++: g++-segfault.zip
What happened (include all command output)?
/opt/homebrew/opt/gcc/bin/g++-16 -DSTDEXEC_ENABLE_LIBDISPATCH -DTBB_USE_DEBUG -isystem /Users/jagot/work/projects/examples/mdspan/stdexec/include -isystem /Users/jagot/work/projects/examples/mdspan/build/stdexec/include -isystem /opt/homebrew/include -g -std=gnu++26 -arch arm64 -fdiagnostics-color=always -freport-bug -fcoroutines -fconcepts-diagnostics-depth=10 -MD -MT CMakeFiles/execution.dir/execution.cpp.o -MF CMakeFiles/execution.dir/execution.cpp.o.d -fmodules-ts -fmodule-mapper=CMakeFiles/execution.dir/execution.cpp.o.modmap -MD -fdeps-format=p1689r5 -x c++ -o CMakeFiles/execution.dir/execution.cpp.o -c /Users/jagot/work/projects/examples/mdspan/execution.cpp
In file included from /Users/jagot/work/projects/examples/mdspan/stdexec/include/stdexec/__detail/__env.hpp:30,
from /Users/jagot/work/projects/examples/mdspan/stdexec/include/stdexec/__detail/__debug.hpp:30,
from /Users/jagot/work/projects/examples/mdspan/stdexec/include/stdexec/__detail/__completion_signatures_of.hpp:29,
from /Users/jagot/work/projects/examples/mdspan/stdexec/include/stdexec/__detail/__as_awaitable.hpp:32,
from /Users/jagot/work/projects/examples/mdspan/stdexec/include/stdexec/execution.hpp:30,
from /Users/jagot/work/projects/examples/mdspan/execution.cpp:1:
/Users/jagot/work/projects/examples/mdspan/stdexec/include/stdexec/__detail/__query.hpp:166:39: internal compiler error: Segmentation fault: 11
166 | inline constexpr forwarding_query_t forwarding_query{};
| ^~~~~~~~~~~~~~~~
/opt/homebrew/Cellar/gcc/16.2.0/bin/../libexec/gcc/aarch64-apple-darwin27/16/cc1plus -quiet -iprefix /opt/homebrew/Cellar/gcc/16.2.0/bin/../lib/gcc/current/gcc/aarch64-apple-darwin27/16/ -MD CMakeFiles/execution.dir/execution.cpp.d -MF CMakeFiles/execution.dir/execution.cpp.o.d -MT CMakeFiles/execution.dir/execution.cpp.o -D__DYNAMIC__ -D STDEXEC_ENABLE_LIBDISPATCH -D TBB_USE_DEBUG -isystem /Users/jagot/work/projects/examples/mdspan/stdexec/include -isystem /Users/jagot/work/projects/examples/mdspan/build/stdexec/include -isystem /opt/homebrew/include /Users/jagot/work/projects/examples/mdspan/execution.cpp -fdeps-file=CMakeFiles/execution.dir/execution.cpp.ddi -fdeps-target=CMakeFiles/execution.dir/execution.cpp.o -fPIC -quiet -dumpdir CMakeFiles/execution.dir/ -dumpbase execution.cpp.cpp -dumpbase-ext .cpp -mmacosx-version-min=27.0.0 -mcpu=apple-m1 -mlittle-endian -mabi=lp64 -g -std=gnu++26 -fdiagnostics-color=always -freport-bug -fcoroutines -fconcepts-diagnostics-depth=10 -fmodules -fmodule-mapper=CMakeFiles/execution.dir/execution.cpp.o.modmap -fdeps-format=p1689r5 -o /var/folders/3x/fs1m7b_d0458zrh1gt84s90c0000gn/T//ccFk6rrM.s
Please submit a full bug report, with preprocessed source.
See <https://github.com/Homebrew/homebrew-core/issues> for instructions.
Preprocessed source stored into /var/folders/3x/fs1m7b_d0458zrh1gt84s90c0000gn/T//cce8GsmI.out file, please attach this to your bugreport.
ninja: build stopped: subcommand failed.What did you expect to happen?
Successful compilation without segfault
Step-by-step reproduction instructions (by running brew commands)
I think the steps for reproduction are fully documented in the bug report attached above, but for completeness:
execution.cpp:
#include <stdexec/execution.hpp>
int main()
{
return 0;
}CMakeLists.txt:
cmake_minimum_required(VERSION 4.0)
project(mdspan-example VERSION 0.1
DESCRIPTION "mdspan-example"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 26)
add_subdirectory(stdexec)
add_executable(execution
execution.cpp)
target_link_libraries(execution PRIVATE STDEXEC::stdexec)
target_compile_options(execution PUBLIC -freport-bug)Subdirectory stdexec is a clone of the repository, as mentioned above.
Source: Homebrew/homebrew-core