From: | cdg@nullstone.com (Christopher Glaeser) |
Newsgroups: | comp.compilers |
Date: | 2 Apr 1996 23:35:01 -0500 |
Organization: | Compilers Central |
References: | 96-03-106 96-03-091 96-03-181 96-03-215 |
Keywords: | C, optimize, parallel |
Mark Mason <mason@ease.com> writes:
> Although the above code is a bad example for the point I want to make,
> the above statement is not entirely correct.
> It is possible with a little work to write an (obviously contrived)
> example which uses a static local variable to communicate between two
> tasks. Having the compiler change the variable from static to auto
> would definitely change the behavior of this program.
Yes, it is possible to write non-conforming programs with undefined
behavior, such that an optimization will change the behavior of the
program. However, programs with undefined behavior should not be used
to prove that an optimzation is "not entirely correct".
A more compelling argument starts with a program that conforms to the
standard, and then shows why a particular optimization changes the
behavior, and is therefore not correct. Of course, if such a
conforming program does not exit, the proof becomes a bit tedious.
If we are allowed to use programs with undefined behavior to discredit
an optimization, then all optimizations can be shown to be "not
entirely correct".
Regards,
Christopher Glaeser cdg@nullstone.com
Nullstone Corporation http://www.nullstone.com
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.