gcc has a large number of optimization methods, some of which correspond to command line options beginning with -f. Is there a way to enable some specific set of these and no others?
The obvious guess would be that you could do something like gcc -fauto-inc-dec a.c
if you wanted just the auto-inc-dec optimization (chosen at random, I don’t care about this specific one), but the manual says that will not work:
Most optimizations are completely disabled at -O0 or if an -O level is not set on the command line, even if individual optimization flags are specified.
(my emphasis). I was a little doubtful about this because I see instances on SO of people using -f flags with no -O (e.g. here), but the manual seems pretty clear that at least most of the time this does nothing.
If you use -O1
or higher, a long list of -f options is included (shown at the manual link above). I would like to know how, if it’s possible, to use only a subset of these.
Motivation: I’d like to understand exactly which optimizations are responsible for some floating point quirks.