Related articles |
---|
[3 earlier articles] |
Re: Compiler optimization and floating point operations gneuner2@comcast.net (George Neuner) (2013-10-24) |
Re: Compiler optimization and floating point operations jm@bourguet.org (Jean-Marc Bourguet) (2013-10-24) |
Re: Compiler optimization and floating point operations sgk@troutmask.apl.washington.edu (Steven G. Kargl) (2013-10-24) |
Re: Compiler optimization and floating point operations gneuner2@comcast.net (George Neuner) (2013-10-24) |
Re: Compiler optimization and floating point operations gah@ugcs.caltech.edu (glen herrmannsfeldt) (2013-10-24) |
Re: Compiler optimization and floating point operations christian.bau@cbau.wanadoo.co.uk (2013-10-28) |
Re: Compiler optimization and floating point operations christian.bau@cbau.wanadoo.co.uk (2013-10-28) |
Re: Compiler optimization and floating point operations cameron.mcinally@nyu.edu (Cameron McInally) (2013-10-28) |
From: | christian.bau@cbau.wanadoo.co.uk |
Newsgroups: | comp.compilers |
Date: | Mon, 28 Oct 2013 15:54:46 -0700 (PDT) |
Organization: | Compilers Central |
References: | 13-10-026 13-10-029 <13-10-030 @comp.compilers> 13-10-032 |
Keywords: | optimize |
Posted-Date: | 28 Oct 2013 22:46:52 EDT |
On Thursday, October 24, 2013 5:38:13 PM UTC+1, Steven G. Kargl wrote:
> #include <stdio.h>
> int
> main(void)
> {
> float a, b;
> a = 0.;
> b = a / a;
> if (a + b != b + a) printf("fubar\n");
> return (0);
> }
>
> Can an optimizing compiler eliminate the if-statement?
It can eliminate the test because it will always be true (on IEEE
implementations where 0.0 / 0.0 is NaN). It cannot eliminate the
if-statement because printf () should be called.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.