To be pedantic, there are 8 different valid -O options you can give to gcc, though there are some that mean the same thing.
The original version of this answer stated there were 7 options. GCC has since added
-Og to bring the total to 8
From the man page:
-O0(do no optimization, the default if no optimization level is specified)
-O3(optimize even more)
-Ofast(optimize very aggressively to the point of breaking standard compliance)
-Og(Optimize debugging experience. -Og enables optimizations that do not interfere with debugging. It should be the optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization while maintaining fast compilation and a good debugging experience.)
-Os(Optimize for size.
-O2optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size.
-Osdisables the following optimization flags:
-falign-functions -falign-jumps -falign-loops -falign-labels -freorder-blocks -freorder-blocks-and-partition -fprefetch-loop-arrays -ftree-vect-loop-version)
There may also be platform specific optimizations, as @pauldoo notes, OS X has