DragonFly kernel List (threaded) for 2007-11
DragonFly BSD
DragonFly kernel List (threaded) for 2007-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: GCC-4 compiler bug


From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Thu, 29 Nov 2007 10:34:10 +0100

Matthew D. Fuller wrote:
Important to note is that this only happens when compiling with
optimization (they claim).


% cc -o test test.c
% ./test
X
% cc -O -o test test.c
% ./test
X
% cc -O2 -o test test.c
% ./test
%

gcc version 4.2.1 20070719 [FreeBSD]

I can confirm this on ubuntu:


gcc 4.1 w/o optimization:
no overflow (= fail)

gcc 4.1 w/o opt && -fwrapv:
overflow (= good)

gcc 4.2 w/o opt:
overflow

gcc 4.2 w/ opt:
no overflow

gcc 4.2 w/ opt && -fwrapv:
overflow

So no matter whether we upgrade gcc or not, we should change the default optimization to behave as if -fwrapv was passed. Or we emit warnings whenever this optimization is taking place. Or both :)

cheers
 simon

--
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   / \



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