[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] Highwire edit



Hi,

On Friday 24 July 2009, Vincent Rivière wrote:
> Helmut Karlowski a écrit :
> > gcc 2.95 puts an 'and' into the program for the & (without
> > optimization), which slows down our atari.

Without optimization gcc doesn't optimize.  I.e. you're seeing what
is written in the C-code.  (I guess -O0 is mainly intended for debugging,
but some problems / incorrect code shows up only in optimized code[1]).


> It is a nonsense to compile without optimization for production code.

How very true. :-)


	- Eero

[1] Some "recent" examples on this for me from ARM...

     With optimizations GCC can e.g. replace successive variable assignments
     with instructions for bulk copy that assume certain alignments.  Due to
     an error in custom allocator (mine) these weren't properly aligned and
     the optimized version created a CPU alignment exception.  Due to an
     (ARM) kernel bug on how it handles alignment exceptions, the process
     was left looping on that memcpy with 100% CPU usage instead of getting
     SIGBUS.  Because of this alignment exception ping-pong to kernel and
     back, it was impossible to pinpoint the problem exactly with debugger. 

    Another example was that GCC optimized certain calculations away because
    it knew that stack frames are 8-byte aligned because ARM EABI requires
    that.  However, a call to a remote parent of that function was done from
    (generated) ASM-code which generator had a bug, its function calls
    didn't conform to EABI requirements (were 4-aligned).  Result was really
    hard to track chrashes in a huge code base and debugging that kind of
   errors at C-level doesn't tell anything.

   Both of these issues required a guru collegue of mine to debug them
   out, happily we had him at hand...