https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110417
Bug ID: 110417
Summary: [modules] Segfault compiling iostream as header unit
on FreeBSD
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: boris at kolpackov dot net
Target Milestone: ---
[Submitting this on behalf of a build2 user who is still waiting for the
bugzilla login[1].]
GCC 12,13,14 all have compilation errors on FreeBSD when trying to compile C++
modules on FreeBSD.
When trying to compile iostream using the command:
g++ -v -save-temps -std=c++20 -fmodules-ts -xc++-system-header iostream
GCC throws internal compiler error in exact form:
header iostream
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc12/gcc/x86_64-portbld-freebsd13.1/12.2.0/lto-wrapper
Target: x86_64-portbld-freebsd13.1
Configured with: /wrkdirs/usr/ports/lang/gcc12/work/gcc-12.2.0/configure
--enable-multilib --with-build-config=bootstrap-lto-noplugin --disable-nls
--enable-gnu-indirect-function --enable-host-shared --enable-plugin
--libdir=/usr/local/lib/gcc12 --libexecdir=/usr/local/libexec/gcc12
--program-suffix=12 --with-as=/usr/local/bin/as --with-gmp=/usr/local
--with-gxx-include-dir=/usr/local/lib/gcc12/include/c++/
--with-gxx-libcxx-include-dir=/usr/include/c++/v1 --with-ld=/usr/local/bin/ld
--with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --without-zstd
--enable-languages=c,c++,objc,fortran,jit --prefix=/usr/local
--localstatedir=/var --mandir=/usr/local/man
--infodir=/usr/local/share/info/gcc12 --build=x86_64-portbld-freebsd13.1
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (FreeBSD Ports Collection)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++20' '-fmodules-ts'
'-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
/usr/local/libexec/gcc12/gcc/x86_64-portbld-freebsd13.1/12.2.0/cc1plus -E
-fdirectives-only -fmodule-header=system -quiet -v iostream -mtune=generic
-march=x86-64 -std=c++20 -fmodules-ts -fpch-preprocess -o a-iostream.ii
ignoring nonexistent directory
"/usr/local/lib/gcc12/gcc/x86_64-portbld-freebsd13.1/12.2.0/include-fixed"
ignoring nonexistent directory
"/usr/local/lib/gcc12/gcc/x86_64-portbld-freebsd13.1/12.2.0/../../../../../x86_64-portbld-freebsd13.1/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc12/include/c++/
/usr/local/lib/gcc12/include/c++//x86_64-portbld-freebsd13.1
/usr/local/lib/gcc12/include/c++//backward
/usr/local/lib/gcc12/gcc/x86_64-portbld-freebsd13.1/12.2.0/include
/usr/local/include
/usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++20' '-fmodules-ts'
'-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'a-'
/usr/local/libexec/gcc12/gcc/x86_64-portbld-freebsd13.1/12.2.0/cc1plus
-fpreprocessed -fdirectives-only a-iostream.ii -fmodule-header=system -quiet
-dumpdir a- -dumpbase iostream -mtune=generic -march=x86-64 -std=c++20 -version
-fmodules-ts -o a-iostream.s
GNU C++20 (FreeBSD Ports Collection) version 12.2.0
(x86_64-portbld-freebsd13.1)
compiled by GNU C version 12.2.0, GMP version 6.2.1, MPFR version
4.2.0-p9, MPC version 1.3.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++20 (FreeBSD Ports Collection) version 12.2.0
(x86_64-portbld-freebsd13.1)
compiled by GNU C version 12.2.0, GMP version 6.2.1, MPFR version
4.2.0-p9, MPC version 1.3.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 8fd6eb50279aca98d331f0f2293361fa
/usr/local/lib/gcc12/include/c++/iostream:77:1: internal compiler error:
Segmentation fault
77 | } // namespace
| ^
0x8270edff3 ???
/usr/src/lib/libc/amd64/string/memmove.S:306
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.
steps to reproduce:
1. Use Freebsd 13.2 or 14.0
2. pkg install gcc-12_5
3. mkdir example && cd example && g++ -v -save-temps -std=c++20 -fmodules-ts
-xc++-system-header iostream
You should now see a similar segmentation fault error.
[1] https://github.com/build2/build2/issues/284