Re: Aliasing in ISO C

Joris.Welkenhuysen@ping.be
24 Feb 1996 23:28:30 -0500

          From comp.compilers

Related articles
Possible to write compiler to Java VM? (I volunteer to summarize) seibel@sirius.com (Peter Seibel) (1996-01-17)
Re: Aliasing in ISO C stevec@pact.srf.ac.uk (1996-02-14)
Re: Aliasing in ISO C rfg@monkeys.com (1996-02-16)
Re: Aliasing in ISO C jplevyak@violet-femmes.cs.uiuc.edu (1996-02-16)
Re: Aliasing in ISO C cdg@nullstone.com (1996-02-16)
Re: Aliasing in ISO C dlmoore@ix.netcom.com (1996-02-17)
Re: Aliasing in ISO C cliffc@ami.sps.mot.com (1996-02-19)
Re: Aliasing in ISO C Joris.Welkenhuysen@ping.be (1996-02-24)
| List of all articles for this month |
From: Joris.Welkenhuysen@ping.be
Newsgroups: comp.compilers
Date: 24 Feb 1996 23:28:30 -0500
Organization: Compilers Central
References: <96-01-037@comp.compilers 96-02-171 96-02-213
Keywords: optimize, standards

>The most interesting "optimization" of this kind is "optimization from
>non-conformance". Some standards contain language which says that a
>program that does so-and-so is non-conforming and that the results are
>undefined. In other words, the compiler is free to do whatever it
>likes with such code. Well, one option is to throw the code away!


A good optimizing compiler should take advantage of these
"non-conformance" and any other lesser known rules and generate code
that is as fast and as compact as possible. However, it should do this
only after having warned the programmer that some more or less obscure
language rule has been used.


A good programmer should investigate all warnings produced by a
compiler.


>So, for example, if a call to a Fortran function has aliased
>parameters, one could simply decide to not call the function! I doubt
>many customers could be convinced of the soundness of such an
>optimization.


A good Fortran compiler uses the no-aliasing property. If it is
detected that some call violates the rule, the compiler should warn
the programmer, because the subroutine won't work correctly for this
call. I doubt many customers are happy with buggy code.


>I had an interesting case where an Ada compiler I was working on
>failed to pass one member of the validation suite with optimization
>on. However, the optimization, which involved optimizing away an
>expression which would have raised an exception, was perfectly valid
>under the old standard. As the new standard requires the exception to
>be raised, it is reasonable to suggest that the bug was not in the
>optimizer, nor in the test suite, but in the standard.


Do you use a C compiler on a Fortran source ? Why then do you use an
Ada-83 compiler on a Ada-95 source. These are different languages.


On the other hand, a good Ada-95 compiler should warn the programmer
when it detects constructs that had a different meaning in Ada-83.
--


Post a followup to this message

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