# g++: internal compiler error: Segmentation fault / in function, at file.c:123 — please submit a full bug report

**Code:** `internal compiler error` · **Category:** C/C++ · **Seen on:** C/C++, GCC, Clang

The compiler itself crashed while compiling your code.

## 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

1. Update the compiler to a newer patch release
2. Reduce the failing file and try another compiler (clang vs gcc)
3. Lower optimisation (`-O1`) or disable LTO to work around it
4. Clear precompiled headers and rebuild

## Detailed fix by platform

### GCC

1. `g++ -v` for the version, `g++ -save-temps` to keep the preprocessed .ii file for a bug report

## How to diagnose

1. **Version** — Latest patch?
2. **Memory** — Killed by OOM?
3. **Repeatable** — Same place each time?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/cpp/internal-compiler-error)
