On Friday 11 March 2011 01:52:17 Ian Lance Taylor wrote: > denis campredon <denis.campredon@xxxxxxxxx> writes: > > I have a question about reduccing test : > > > > > > - I found a program on the net, and tried to built it. But I find > > something wrong in one file : > > when I built it with g++ -g -O0 the binary is about 1,2M. > > when I built it with g++ -g -Os the binary is about 33M. about 25M > > for O1 O2, O3 > > when I built it with clang++, the size is always about 1,4M > > without debug option, the file has about the same size with any > > optimization flags > > > > I tried to remove a few small functions, or pieces of code, but most > > of the time, the code size moves for +/- 1 to 4M. > > > > I don't know how do reduce the case, because the result is > > unpredictable, and it takes 20s to compile with 01, the fastest. > > What do you care about? > > Your subject line says "Code bloating", but debug info is not code. The > size without the -g option is the size that matters. Using the -g > option adds debug info, but that is not code bloat. > > Ian You can also sometimes shrink it a little more by using strip (man strip). Using strip in conjunction with -g is about as handy as a bunch of flowers in a bar fight. Frans