Related articles |
---|
Justifying Optimization mike.dillon@lmco.com (MICHAEL DILLON) (2003-01-17) |
Re: Justifying Optimization joachim_d@gmx.de (Joachim Durchholz) (2003-01-20) |
Re: Justifying Optimization srikanth@cup.hp.com (srikanth) (2003-01-21) |
Re: Justifying Optimization christian.bau@cbau.freeserve.co.uk (Christian Bau) (2003-01-21) |
Re: Justifying Optimization vbdis@aol.com (2003-01-21) |
Re: Justifying Optimization jgd@cix.co.uk (2003-01-21) |
Re: Justifying Optimization touati@prism.uvsq.fr (Sid TOUATI) (2003-01-25) |
Re: Justifying Optimization ONeillCJ@logica.com (Conor O'Neill) (2003-01-25) |
Re: Justifying Optimization jvorbrueggen@mediasec.de (Jan C. =?iso-8859-1?Q?Vorbr=FCggen?=) (2003-01-25) |
Re: Justifying Optimization jvorbrueggen@mediasec.de (Jan C.=?iso-8859-1?Q?Vorbr=FCggen?=) (2003-01-25) |
Re: Justifying Optimization jvorbrueggen@mediasec.de (Jan C.=?iso-8859-1?Q?Vorbr=FCggen?=) (2003-01-25) |
Re: Justifying Optimization joachim_d@gmx.de (Joachim Durchholz) (2003-01-26) |
Re: Justifying Optimization lars@bearnip.com (2003-01-26) |
[13 later articles] |
From: | Sid TOUATI <touati@prism.uvsq.fr> |
Newsgroups: | comp.compilers |
Date: | 25 Jan 2003 00:47:40 -0500 |
Organization: | PRISM |
References: | 03-01-088 |
Keywords: | optimize, practice |
Posted-Date: | 25 Jan 2003 00:47:40 EST |
Did you heard about a compiler (even a software or a processor) that
is bug-free ?
Very often, the "bugs" introduced by the optimizing compiler are
caused by bad programming styles. A lot of programmers (especially in
C and fortran) make assumptions about how the compiler would generate
the code, and do not follow the semantics of the language. This is
because some programmers use high level languages and think in a low
level way to hand tune their application.
Example :
float A[10], B[10];
for (i=0; i<20;i++){
A[i]=.... /* the programmer assumes A and B contiguous in memory : use A
as an offset to access B */
}
for (i=0; i<10;i++){
...=B[i]
}
This simple code woul certainly run well if optimization is turned off.
When switching to on, expect to have uncorrect results. Now, who did a
bad job ? the programmer or the compiler ?
BTW, there are numerous formal high level languages that promise you
zero bugs, even with optimizations.
Sid
Return to the
comp.compilers page.
Search the
comp.compilers archives again.