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.
C/C++ 프로젝트를 위한 GCC 컴파일러 기술. 최적화 수준, 경고 플래그, 디버그 빌드, LTO, 새니타이저 계측을 선택하거나 GCC를 사용하여 컴파일 오류를 진단할 때 사용합니다. 디버그 및 릴리스에 대한 플래그 선택, ABI 문제, 전처리기 매크로, 프로필 기반 최적화 및 빌드 시스템과의 통합을 다룹니다. gcc 플래그, 컴파일 오류, 성능 조정, 경고 억제 또는 표준 간 컴파일에 대한 쿼리에서 활성화됩니다. 출처: mohitmishra786/low-level-dev-skills.