🌐
GNU
gcc.gnu.org › onlinedocs › gcc › Option-Summary.html
Option Summary (Using the GNU Compiler Collection (GCC))
See Options for Code Generation Conventions. -fcall-saved-reg -fcall-used-reg -ffixed-reg -fexceptions -fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables -fasynchronous-unwind-tables -fno-gnu-unique -finhibit-size-directive -fcommon -fno-ident -fpcc-struct-return -fpic -fPIC -fpie -fPIE -fno-plt -fno-jump-tables -fno-bit-tests -frecord-gcc-switches -freg-struct-return -fshort-enums -fshort-wchar -fverbose-asm -fpack-struct[=n] -fleading-underscore -ftls-model=model -fstack-reuse=reuse_level -ftrampolines -ftrampoline-impl=[stack|heap] -ftrapv -fwrapv -fwrapv-pointer -fvisibility=[default|internal|hidden|protected] -fstrict-volatile-bitfields -fsync-libcalls -fzero-init-padding-bits=value -Qy -Qn
Discussions

What do the -f and -m in gcc/clang compiler options stand for - Stack Overflow
Summary: What do the -f and -m in gcc and clang compiler options stand for? Details: When using clang I've noticed that many compiler options start with -f and others start with -m. I assume that More on stackoverflow.com
🌐 stackoverflow.com
command line arguments - What does gcc -E option stand for? - Stack Overflow
According to gcc manual, the -E option only preprocesses the .c source file, without running the compiler and just giving an input file (.i). But what does the -E stand for? More on stackoverflow.com
🌐 stackoverflow.com
why do i need to use gcc -Wall
GCC has a variety of options beginning with -W that enable warnings. Warnings are where the compiler tells you about code that is technically valid, but that is probably not what you actually meant. C is full of foot-guns, and having warnings enabled will help you avoid them. It seems like half the time I'm helping somebody out on this subreddit I start off with "enable warnings in your compiler — it will point out the bug in your code". -Wall specifically means to enable warnings for "constructions that some users consider questionable, and that are easy to avoid (or modify to prevent the warning), even in conjunction with macros". It's a good baseline set of warning categories, and there's very little reason not to enable them. Once upon a time this option actually did turn on all warnings, hence the name, but nowadays there are many more categories available than what -Wall will give you. -Wall can't really be expanded to include them because some of them aren't particularly useful, or they warn about things that aren't likely to be problems, or because it would break things for people or programs that treat compilation warnings as errors. More on reddit.com
🌐 r/C_Programming
22
20
March 31, 2022
What are the useful GCC flags for C? - Stack Overflow
It's not really helpful for detecting ... option makes using -S to inspect the assembly output much, much nicer. AT&T assembly syntax hurts my head far too much. ... The difference between AT&T and Intel to me is the difference between C# and Java. Just syntax. Both awful. :) 2010-08-04T07:59:42.337Z+00:00 ... +1 @michael for making gcc use intel ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
IBM
ibm.com › docs › en › xl-c-and-cpp-linux › 16.1.0
Supported GCC options
We cannot provide a description for this page right now
🌐
Linux Man Pages
man7.org › linux › man-pages › man1 › gcc.1.html
gcc(1) - Linux manual page
When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker. Then the output consists of object files output by the assembler.
🌐
Florida State University
cs.fsu.edu › ~baker › ada › gnat › html › gcc_3.html
3. GCC Command Options
Print (on the standard output) a description of the command line options understood by gcc. If the `-v' option is also specified then `--help' will also be passed on to the various processes invoked by gcc, so that they can display the command line options they accept.
🌐
GNU
gcc.gnu.org › onlinedocs › gcc › Overall-Options.html
Overall Options (Using the GNU Compiler Collection (GCC))
The output is sensitive to the effects of previous command-line options, so for example it is possible to find out which optimizations are enabled at -O2 by using: ... gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts diff /tmp/O2-opts /tmp/O3-opts | grep enabled
Find elsewhere
🌐
SPEC
spec.org › hpc2021 › flags › gcc.html
GNU Compiler Collection Flags
Popular values for n include 72 (the standard and the default), 80 (card image), and 132 (corresponding to "extended-source" options in some popular compilers). n may also be "none" meaning that the entire line is meaningful and that continued character constants never have implicit spaces appended to them to fill out the line. -ffixed-line-length-0 means the same thing as -ffixed-line-length-none. GCC_compiler_path_eater ·
🌐
Stanford
web.stanford.edu › class › archive › cs › cs107 › cs107.1202 › resources › gcc
CS107 Compiling C Programs with GCC
We generally don't want our programs named a.out, so you can give gcc an option, -o programName, to tell it what to name the runnable file:
🌐
GCC Contributors Guide
dmalcolm.fedorapeople.org › gcc › 2015-08-31 › rst-experiment › gcc-command-options.html
GCC Command Options — gcc 6 documentation
When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The ‘overall options’ allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker.
🌐
Medium
medium.com › @eightlimbed › commonly-used-gcc-options-explained-8304dfccea20
Commonly Used GCC Options Explained | by Lee Gaines | Medium
December 19, 2019 - Werror — This option turns any warning into an error. Usually warnings are just that: they warn you of potential problems, but they still allow GCC to compile your program.
🌐
GNU
gcc.gnu.org › onlinedocs › gcc-3.2.2 › gcc › Invoking-GCC.html
GCC Command Options - GCC, the GNU Compiler Collection
When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker.
Top answer
1 of 1
3

Summary

  • This option was introduced on compilers much earlier than GCC, and GCC used the same naming for compatibility.

  • My best guess from the historical evidence is that -E stands for "expand macros".

  • The authors of those earlier compilers couldn't call it -P because there was already a -P option, which also ran only the preprocessor, but wrote the output to .i files instead of to standard output. -p was also taken.

  • Over time, -E became preferred to -P, and when GCC was written, it supported only -E and not -P.


Despite being supposedly off topic for Stack Overflow, I think a bit of history will help explain how this option got its name.

gcc(1) inherited its basic command line options from much earlier Unix C compilers. Many versions can be found in the Unix Tree archive.

It looks like the first version that supported -E was Research Unix V7, circa 1979: cc(1) source, man page source. There was also a -P option that also just ran the preprocessor, but sent the result to a file foo.i instead of to standard output. V6 had already supported -P but not -E: cc(1) source, man page source.

This at least answers why -E wasn't named -P instead: because -P was already in use. (And -p was also taken, it was used to request profiling.) The only hint I found as to why -E was chosen is that the corresponding flag variable in the source code is named exflag. I would hazard a guess that this stands for "expand", as what -E does is basically to expand macros.

It appears that -P was eventually deprecated in favor of -E. V8 still supported it, but omitted it from the man page. V10 (circa 1989) included two versions of the compiler, cc which compiled traditional C, and lcc for ANSI C. The man page says that cc supports -P with the preprocessor behavior, but for lcc, -P did something else ("write declarations for all defined globals on standard error"). They both supported -E. On other fronts, 32V and BSD, at least initially, supported both, but -P would emit a warning that it was obsolete and -E should be used instead.

It looks like gcc, from its earliest version, only supported -E and not -P. Since then, a -P option has been introduced, but it does something else ("inhibit generation of linemarkers").

🌐
GitHub
cs107e.github.io › guides › gcc
CS107E Guide: Bare-Metal Programming using gcc
January 30, 2026 - These are clever optimizations, but the assumptions they depend on are not guaranteed to hold in the bare-metal environment. By using -ffreestanding, you are teling gcc to not assume a standard library environment and to not apply such substitutions or rearrangements. The linker option -nostdlib is used to link a program intended to run freestanding.
🌐
GNU
gcc.gnu.org › onlinedocs › gcc-3.2.3 › gcc › Invoking-GCC.html
GCC Command Options
When you invoke GCC, it normally does preprocessing, compilation, assembly and linking. The "overall options" allow you to stop this process at an intermediate stage. For example, the -c option says not to run the linker.
🌐
UC3M
it.uc3m.es › pbasanta › asng › course_notes › compiler_en.html
Chapter 14. The most used options of the gcc compiler
The GNU C compiler gcc is the application that given a set of files with C code, generates an executable program. As with the rest of applications, it can be invoked from the command interpreter. With the option --version the compiler only shows information about its version.
🌐
Reddit
reddit.com › r/c_programming › why do i need to use gcc -wall
r/C_Programming on Reddit: why do i need to use gcc -Wall
March 31, 2022 -

I noticed in a lot of examples of compiling .c files they use

gcc myfile.c -o myfile -Wall

but none of the examples I have seen mention what -Wall does and it seems like it's assumed that everyone knows what that is.

My programs seem to compile the same with or without it. I googled a little for "gcc -Wall" and similar phrases but cant find much info on it. Can someone explain what it does? or point me in the right direction?

🌐
Stanford
web.stanford.edu › class › archive › cs › cs107 › cs107.1186 › unixref › topics › gcc
gcc (how to compile c programs)
We generally don't want our programs named a.out, so you can give gcc an option, -o programName, to tell it what to name the runnable file:
Top answer
1 of 16
178

Here are mine:

  • -Wextra and -Wall: essential.
  • -Wfloat-equal: useful because usually testing floating-point numbers for equality is bad.
  • -Wundef: warn if an uninitialized identifier is evaluated in an #if directive.
  • -Wshadow: warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed.
  • -Wpointer-arith: warn if anything depends upon the size of a function or of void.
  • -Wcast-align: warn whenever a pointer is cast such that the required alignment of the target is increased. For example, warn if a char * is cast to an int * on machines where integers can only be accessed at two- or four-byte boundaries.
  • -Wstrict-prototypes: warn if a function is declared or defined without specifying the argument types.
  • -Wstrict-overflow=5: warns about cases where the compiler optimizes based on the assumption that signed overflow does not occur. (The value 5 may be too strict, see the manual page.)
  • -Wwrite-strings: give string constants the type const char[length] so that copying the address of one into a non-const char * pointer will get a warning.
  • -Waggregate-return: warn if any functions that return structures or unions are defined or called.
  • -Wcast-qual: warn whenever a pointer is cast to remove a type qualifier from the target type*.
  • -Wswitch-default: warn whenever a switch statement does not have a default case*.
  • -Wswitch-enum: warn whenever a switch statement has an index of enumerated type and lacks a case for one or more of the named codes of that enumeration*.
  • -Wconversion: warn for implicit conversions that may alter a value*.
  • -Wunreachable-code: warn if the compiler detects that code will never be executed*.

Those marked * sometimes give too many spurious warnings, so I use them on as-needed basis.

2 of 16
77

Several of the -f code generation options are interesting:

  • -fverbose-asm is useful if you're compiling with -S to examine the assembly output - it adds some informative comments.

  • -finstrument-functions adds code to call user-supplied profiling functions at every function entry and exit point.

  • --coverage instruments the branches and calls in the program and creates a coverage notes file, so that when the program is run coverage data is produced that can be formatted by the gcov program to help analysing test coverage.

  • -fsanitize={address,thread,undefined} enables the AddressSanitizer, ThreadSanitizer and UndefinedBehaviorSanitizer code sanitizers, respectively. These instrument the program to check for various sorts of errors at runtime.

Previously this answer also mentioned -ftrapv, however this functionality has been superseded by -fsanitize=signed-integer-overflow which is one of the sanitizers enabled by -fsanitize=undefined.