------- Additional Comments From wilson at gcc dot gnu dot org  2005-03-10 
02:48 -------
The linux kernel requires optimization to be correctly compiled.  This is a
deliberate design decision by the linux kernel developers.

Part of the reason is the kernel's use of extern inline as already mentioned. 
If used as intended, extern inline works without -O.  The linux kernel however
slightly abuses the feature in the interest of reducing kernel code size, thus
resulting in code that can't be compiled correctly without -O.

I believe there is also another issue.  I think there is a process creation
routine that takes advantage of the fact that gcc won't create a stack frame
with optimization in a leaf routine, thus allowing them to have C code to set
the initial stack pointer for the new process.  Normally, setting the stack
pointer would cause all kinds of havoc, but it works in this one special case,
and it only works if you compile with optimization.  I don't recall exactly
where I saw this trick, but I think it was in the linux kernel.

Anyways, a linux kernel developer could answer these kinds of questions better
than a gcc developer.  There may be other reasons why they require optimization.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20217

Reply via email to