g++: internal compiler error: Segmentation fault / in function, at file.c:123 — please submit a full bug report
The compiler itself crashed while compiling your code.
internal compiler errorinternal compiler error: Segmentation faultplease submit a full bug report Meaning
An ICE is a compiler bug, not (usually) a mistake in your code, although unusual template or constexpr code often triggers it. Memory exhaustion can look like an ICE too.
Common causes
- Bug in this compiler version (often with heavy templates, constexpr, concepts)
- Out of memory during compilation
- Corrupted or incompatible precompiled headers
- Faulty RAM or overheating (random ICEs)
⚡ Quick fix
- Update the compiler to a newer patch release
- Reduce the failing file and try another compiler (clang vs gcc)
- Lower optimisation (
-O1) or disable LTO to work around it - Clear precompiled headers and rebuild
Detailed fix by platform
GCC
g++ -vfor the version,g++ -save-tempsto keep the preprocessed .ii file for a bug report
How to diagnose
- Version — Latest patch?
- Memory — Killed by OOM?
- Repeatable — Same place each time?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- 'this' was not captured C++: error: 'this' was not captured for this lambda function
- cannot be implicitly captured Clang: error: variable 'x' cannot be implicitly captured in a lambda with no capture-default specified
- cannot bind non-const lvalue reference C++: error: cannot bind non-const lvalue reference of type 'T&' to an rvalue of type 'T'
Most viewed in C/C++
- Bus error C/C++: Bus error (core dumped) — SIGBUS from misaligned access or a bad memory-mapped file
- AddressSanitizer: heap-buffer-overflow C/C++: ==ERROR: AddressSanitizer: heap-buffer-overflow on address — READ/WRITE of size N
- AddressSanitizer: heap-use-after-free C/C++: ==ERROR: AddressSanitizer: heap-use-after-free on address — memory used after delete/free
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 2 Dec 2026