Guide agents through GCC invocation: flag selection, build modes, warning triage, PGO, LTO, and common error patterns. Assume the project uses GNU Make, CMake, or a shell script.
| Debug | -g -O0 -Wall -Wextra | | Debug + debuggable optimisation | -g -Og -Wall -Wextra | | Release | -O2 -DNDEBUG -Wall | | Release (max perf, native only) | -O3 -march=native -DNDEBUG | | Release (min size) | -Os -DNDEBUG | | Sanitizer (dev) | -g -O1 -fsanitize=address,undefined |
Always pass -std=c11 / -std=c++17 (or the required standard) explicitly. Never rely on the implicit default.
GCC compiler skill for C/C++ projects. Use when selecting optimization levels, warning flags, debug builds, LTO, sanitizer instrumentation, or diagnosing compilation errors with GCC. Covers flag selection for debug vs release, ABI concerns, preprocessor macros, profile-guided optimization, and integration with build systems. Activates on queries about gcc flags, compilation errors, performance tuning, warning suppression, or cross-standard compilation. Source: mohitmishra786/low-level-dev-skills.