inlining + optimization = nuisance bugs

"Quinn Tyler Jackson" <qjackson@wave.home.com>
18 Jun 1998 11:12:21 -0400

          From comp.compilers

Related articles
why not inline all functions? sanvitam@std.teradyne.com (Mark Sanvitale) (1998-06-09)
Re: why not inline all functions? portland@uswest.net (Thomas Niemann) (1998-06-11)
inlining + optimization = nuisance bugs qjackson@wave.home.com (Quinn Tyler Jackson) (1998-06-18)
Re: inlining + optimization = nuisance bugs bill@amber.ssd.csd.harris.com (1998-06-19)
Re: inlining + optimization = nuisance bugs acoetmeur@icdc.caissedesdepots.fr (Alain Coetmeur) (1998-06-24)
Re: inlining + optimization = nuisance bugs qjackson@wave.home.com (Quinn Tyler Jackson) (1998-08-10)
Re: inlining + optimization = nuisance bugs cfc@world.std.com (Chris F Clark) (1998-08-10)
Re: inlining + optimization = nuisance bugs darcy@usul.CS.Berkeley.EDU (1998-08-13)
Re: inlining + optimization = nuisance bugs darcy@usul.CS.Berkeley.EDU (1998-08-13)
[27 later articles]
| List of all articles for this month |

From: "Quinn Tyler Jackson" <qjackson@wave.home.com>
Newsgroups: comp.compilers
Date: 18 Jun 1998 11:12:21 -0400
Organization: Compilers Central
References: 98-06-032 98-06-065
Keywords: optimize, practice

>Inlining a procedure exposes the procedure's body to the surrounding
>code, allowing for classical optimizations to take place. One of the
>benchmarks in our test suite terminated with a divide-by-zero exception
>after inlining. A matrix-multiplication function was inlined. The
>optimizer could then determine that there was no use of the calculation,
>so the code was eliminated. Thus, it took zero time to do the
>calculation. The divide-by-zero error occurred when dividing elapsed
>time into a constant. At any rate, we had qualms about reporting
>benchmark figures for such a result.


My CShuComplex class declares most of the member functions inline, but
when the MSVC++ compiler has optimizations turned on, the code breaks
at runtime because it optimizes something or other into oblivion.
Inline in combination with aggressive optimization has done similar
things to me on several builds, and so, as a general rule, I turn off
all aggressive optimizations when I inline, since I have found that
this kind of compiler-introduced bug is difficult to associate with a
specific member function. I prefer to have my release build function
identically to my debug builds, minus the performance hit that a
typical debug build introduces.


Cheers,


Quinn
[Bugs in a Microsoft product? Hard to believe. -John]






--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.