Related articles |
---|
[15 earlier articles] |
Re: compiler bugs r3jjs@yahoo.com (Jeremy J Starcher) (2009-04-29) |
Re: compiler bugs walter@bytecraft.com (Walter Banks) (2009-04-30) |
Re: compiler bugs cfc@shell01.TheWorld.com (Chris F Clark) (2009-04-30) |
Re: compiler bugs anton@mips.complang.tuwien.ac.at (2009-05-01) |
Re: compiler bugs gene.ressler@gmail.com (Gene) (2009-05-01) |
Re: compiler bugs cdg@nullstone.com (Christopher Glaeser) (2009-05-04) |
Re: compiler bugs anton@mips.complang.tuwien.ac.at (2009-05-05) |
Re: compiler bugs gah@ugcs.caltech.edu (glen herrmannsfeldt) (2009-05-05) |
Re: compiler bugs gah@ugcs.caltech.edu (glen herrmannsfeldt) (2009-05-05) |
Re: compiler bugs cdg@nullstone.com (Christopher Glaeser) (2009-05-06) |
Re: compiler bugs anton@mips.complang.tuwien.ac.at (2009-05-06) |
Re: compiler bugs cfc@shell01.TheWorld.com (Chris F Clark) (2009-05-07) |
Re: compiler bugs barry.j.kelly@gmail.com (Barry Kelly) (2009-05-10) |
[26 later articles] |
From: | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
Newsgroups: | comp.compilers |
Date: | Tue, 05 May 2009 16:45:43 GMT |
Organization: | Institut fuer Computersprachen, Technische Universitaet Wien |
References: | 09-04-072 09-04-086 09-05-010 09-05-022 |
Keywords: | errors |
Posted-Date: | 05 May 2009 14:17:54 EDT |
"Christopher Glaeser" <cdg@nullstone.com> writes:
>> An optimizer that breaks a program is a bad idea. There are
>> apologists (of program-breaking optimizers) that claim that the
>> program was already broken without the optimizer, because it does not
>> conform to some language standard. But actually the program does
>> conform with the language as it is implemented by the compiler without
>> optimization and it behaves as intended by the programmer, so it is
>> correct.
>
>Can you please provide us with the list of optimizations that will not
>affect the behavior of any program that uses language features that are
>defined by the language standard to have undefined behavior?
*The* list, for all languages? Please contact me for my consultancy
rates:-). Actually, you could make identifying such program-breaking
behaviour an additional service of your business.
Anyway, to give some examples: many forms of constant folding, copy
propagation and common subexpression elimination; but typically a
particular optimization can be performed in a behaviour-preserving way
or in a program-breaking way. E.g., evaluating a constant expression
may result in an exception (e.g., consider "1/0"); proper constant
folding has to preserve that visible behaviour (giving a warning about
the expression may also be a good idea) instead of compiling just
anything because the language standard does not cover this case.
- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/
Return to the
comp.compilers page.
Search the
comp.compilers archives again.