https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100358
Bug ID: 100358 Summary: Not all filesystems support posix_fallocate() (e.g. ZFS) Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: andy at omnios dot org Target Milestone: --- I've been troubleshooting a raft of testsuite failures with gcc 11.1 on OmniOS (an illumos distribution, using Target: x86_64-pc-solaris2.11). For example: dir-only-3.C:10:2: internal compiler error: Segmentation Fault Please submit a full bug report, with preprocessed source if appropriate. > $G C++ symbol demangling enabled > $C fffffc7fffdf2b90 libc.so.1`memcpy+0x554() fffffc7fffdf2bd0 elf_out::end+0x102() fffffc7fffdf2ca0 finish_module_processing+0x4cf() fffffc7fffdf2d70 c_parse_final_cleanups+0x78c() fffffc7fffdf2d90 compile_file+0x24() fffffc7fffdf2e50 toplev::main+0x7e9() fffffc7fffdf2e80 main+0x31() fffffc7fffdf2eb0 _start_crt+0x87() fffffc7fffdf2ec0 _start+0x18() This turns out to be due to the use of posix_fallocate() in gcc/cp/module.cc - elf_out::create_mapping() Although illumos supports the posix_fallocate() function, I am running gcc to compile files on a ZFS filesystem, and that filesystem does not support this. Swapping back to ftruncate() resolves the problem, and I suggest that if posix_fallocate() fails with EINVAL, the code should then try ftruncate().