GCC-4 compiler bug

Simon 'corecode' Schubert corecode at fs.ei.tum.de
Tue Nov 27 16:11:13 PST 2007

Matthew Dillon wrote:
    GCC-4.1.2 is not properly handling signed 64 bit rollovers.  It's
    not doing it properly for 32 bit rollovers either.
    This program should generate an "X" when run.  It doesn't.
Yea, it seems that GCC 4 started to exploit the C99 standard which says that signed integer overflows are undefined.  This is a nasty thing and comes unexpected for many programmers and existing source.

Important to note is that this only happens when compiling with optimization (they claim).  This is even worse than this happening all the time, IMO.

We have two choices here:  "fix" code so that it doesn't rely on signed integer overflows or hack gcc so that it won't do this one particular optimization.

Now I would be inclined to say that gcc should behave, but on the other hand I can't really see applications to this *except for checking integer overflows in the first place*.


Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \

More information about the Kernel mailing list