A very quick example of why big -O3 gcc optimizations are a bad thing?

my /etc/make.conf has

USA_RESIDENT=NO
CFLAGS=-O3 -pipe -mcpu=pentiumpro -march=pentiumpro -fomit-frame-pointer
NOPROFILE=true

(NOPROFILE=true because profiled libraries fail to build with no frame pointer)

now, cd /usr/ports/net/kicq; make install

bender:~> kicq
Segmentation fault(core dumped)
bender:~>

kicq is broken, and segfaults. Infact it dumps core with a problem in the
QT library with QString::find(). But why? due to -O3 optimizations, kicq
does something stupid and passes an invalid value/pointer to a QString
causing it to dump core. I haven't bothered to go into this in detail
(compiling kicq AND qt with -g to see whats happening). Why bother ?

No optimizations fixes this.

Mind you, there are a few other ports that are like this also, it appears
to be a bug with gcc 2.96.2's C++ compiler. It was always fine in gcc
2.7.2.

Make world runs perfectly with my -O3 and -mcpu=pentiumpro optimizations,
however. Its just a few ports that happen to be in C++. So gcc definately
has problems there.

Hopefully this will show why you should be real cautious, and the second
you have problems with a program dumping core recompile WITHOUT
optmizations, or ONLY use -O, no higher.

--
Martin Minkus aka DiSKiLLeR
Email: [EMAIL PROTECTED]   Web: http://www.diskiller.net

I live in a world of paradox... my willingness to destroy is
your chance for improvement, my hate is your faith, my failure
is your victory - a victory that won't last.



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to