gcc
GCC
GCC (GNU Compiler Collection) is the standard C, C++, and Fortran compiler on Linux. More than a translator to machine code—it optimizes aggressively, reordering instructions, eliminating dead code, vectorizing loops, and inlining functions. Performance can change by an order of magnitude based on optimization choices.
In HPC, understanding what GCC does with your source is as important as understanding what your code does. -O3 is a starting point. Read the generated assembly when a loop is slower than expected; it reveals what the compiler actually emitted and where the bottleneck is.
$ gcc -O3 -march=native -S -fverbose-asm hot_loop.c -o hot_loop.s $ cat hot_loop.s # read assembly with source annotations
Compile with appropriate flags for your target, enable warnings to catch bugs early, and learn to read assembly to debug performance.
Concepts
gcc.md · Last modified: by 127.0.0.1
