Search notes:

gcc -v

gcc -v prints the commands executed to run the stages of compilation
In adition, it reports the version number of
The output of -v goes to stderr.

main.c

#include <stdio.h>

int main() {
  printf("Hello world\n");
}
Github repository about-gcc, path: /options/v/main.c

Invoking the compiler with -v

#  vi: ft=sh
#
#  The output of -v is printed to stderr.
#
#  The following command redirects stderr to v.out
#
gcc -v main.c 2> v.out

#
#  Some greps on v.out  
#
grep 'gcc version'           v.out
grep 'Thread model'          v.out
grep 'Configured with'       v.out
grep 'Target'                v.out
grep 'COLLECT_LTO_WRAPPER'   v.out
grep 'COLLECT_GCC'           v.out

#
#   With the .S suffix, cc1 is invoked first with
#   the -E flag
#
gcc -v assembly.S 2> v.out

#
#   With the .i suffix, cc1 is invoked with the -fpreprocessed flag
#
gcc -v already-preprocessed.i 2> v.out
Github repository about-gcc, path: /options/v/invoke_gcc_with_-v

TODO

gcc -### is similar, but does not execute the commands.

See also

GCC options

Index