[Gllug] gcc

Nix nix at esperi.demon.co.uk
Fri Aug 1 20:49:52 UTC 2003


On Fri, 1 Aug 2003, Doug Winter spake:
> On Fri 01 Aug Peter Childs wrote:
>> Ok I've just switched -O on in gcc to compile. and my program has

-O? If you're interested in speed, I'd recommend at least -O2
-march=i686 (or equivalent); if you're more into size, -Os -march=i686
will do a better job.

-O is meant for speed-of-compilation; it bypasses a large number of
optimizations.

>> stopped working. I was trying to speed it up:) but now it does not
>> work at all. 
> 
> You've got a bug, probably a pointer handling problem.  Sometimes these
> only manifest themselves after the optimiser has run.

What's a `pointer handling' problem? If it's a chase through a wild
pointer, that'll die no matter what; if it's an aliasing problem
(e.g. *((int *)&some_double)) then you'll not see it at -O, because
alias analysis is disabled below -O2. (This will definitely not remain
the case forever; the tree-ssa branch is doing some alias analysis at -O
right now.)

-Wall -ansi -pedantic might tell you what's going wrong; maybe it's a
compiler bug, but more likely you're invoking undefined behaviour
somewhere.

If it's a memory-handling related problem, the holy and irreplaceable
valgrind might help.

-- 
`We cannot get a new line down the pipe due to a blockage and we cannot
 dig up the road to clear the blockage because it is covered with the
 wrong type of tarmac.' --- British Telecom, via Mark Lowes

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list