Subject: -O
To: None <>
From: Frank van der Linden <>
List: current-users
Date: 04/13/1994 14:22:52
There seem to be several people who seem to use -O6 for optimization
with gcc. I always wondered how this came about. If I remember correctly,
it used to be in the Linux kernel Makefile too. So, I did some checking
in the 2.4.x, 2.5.x and -current gcc code (which is 2.4.5 with some
code reshuffling and modifications), and it always came down to this piece
of code (toplev.c):

  if (optimize >= 2)
      flag_cse_follow_jumps = 1;
      flag_cse_skip_blocks = 1;
      flag_expensive_optimizations = 1;
      flag_strength_reduce = 1;
      flag_rerun_cse_after_loop = 1;
      flag_caller_saves = 1;
      flag_schedule_insns = 1;
      flag_schedule_insns_after_reload = 1;

  /* Allow default optimizations to be specified on a per-machine basis.  */

So, anything higher than 2 can optionally be handled by the macro
OPTIMIZATION_OPTIONS(). Which is defined in the config files for some
architectures, but only 2 of them use -O3 (to enable inline functions
by default).

I don't know if anyone knows how -O6 ended up being used sometimes (for example,
it is used in /sys/arch/i386/boot/Makefile), but it seems useless to me (ok,
it's the same as -O2, so it doesn't do any harm either.. you could even claim
that any Makefile using it is prepared for future releases of gcc ;))

- Frank