Mail Archives: djgpp/1996/03/10/01:16:08
On Fri, 8 Mar 1996, Michael Schuster wrote:
> I' ve realized a strange(?) behaviour of the optimization switch in GNU
> C/C++.
> I wrote a program to convert binary files to ASCII files (nothing
> _really_exiting, I know) and after a few days, it worked really fine.
>
> After all I decided to compile with the -O3 option (no error
> message at all) but when executing suddenly it chrashed. So I 've
> a simple question: Is that what you 'ld call a bug - or is it quite normal?
Are you sure it isn't a bug in your program that just surfaces when you
compile with optimizations? The -O3 switch enables functions inlining;
maybe this triggers some bug that won't show otherwise. Does this happen
with -O or -O2? I'd suggest to try to debug the optimized program a bit
before you decide that's a compiler bug. You can use the `symify'
program to translate the stack trace printed at the time of crash to a
list of source filenames and line numbers which will point to the place
where it crashed. You can also compile with -O3 *and* -g and debug an
optimized program with any debugger--in GCC, these two don't contradict.
- Raw text -