|Possible to write compiler to Java VM? (I volunteer to summarize) firstname.lastname@example.org (Peter Seibel) (1996-01-17)|
|Re: Possible to write compiler to Java VM? email@example.com (1996-02-09)|
|Aliasing in ISO C (was: Re: Possible to write compiler to Java VM?) firstname.lastname@example.org (1996-02-13)|
|Re: Aliasing in ISO C email@example.com (1996-02-14)|
|Re: Aliasing in ISO C firstname.lastname@example.org (1996-02-16)|
|Re: Aliasing in ISO C email@example.com (1996-02-16)|
|Re: Aliasing in ISO C firstname.lastname@example.org (1996-02-16)|
|Re: Aliasing in ISO C email@example.com (1996-02-17)|
|Languages: The Bigger the Uglier (was: Re: Aliasing in ISO C) firstname.lastname@example.org (1996-02-19)|
|Re: Aliasing in ISO C email@example.com (1996-02-19)|
|Re: Languages: The Bigger the Uglier (was: Re: Aliasing in ISO C) jgm@CS.Cornell.EDU (1996-02-19)|
|[5 later articles]|
|From:||firstname.lastname@example.org (Ronald F. Guilmette)|
|Date:||16 Feb 1996 00:43:46 -0500|
|Organization:||Infinite Monkeys & Co.|
|References:||96-01-037 96-02-082 96-02-116|
|Keywords:||C, design, GC|
Stavros Macrakis <email@example.com> wrote:
> There are also several features [in C] that make certain
> optimizations pretty much impossible, namely the possibility of
> almost arbitrary aliasing.
Ronald F. Guilmette <firstname.lastname@example.org> wrote:
>This is a fairly common misconception about C, IMHO.
>The C standard is pretty clear in saying that in the following
>function, it is permissible to avoid the second indirection and load
>from *p1... assuming that you still have the value previously loaded
>from *p1 in a register somewhere:
> volatile int i;
> volatile char ch1, ch2;
> void foobar (char *p1, int *p2)
> ch1 = *p1;
> *p2 = i;
> ch2 = *p1;
>In other words, the C standard is pretty clear in saying that C only
>supports aliasing of (i.e. multiple pointers to) ``compatible'' (which
>in practice usually means ``identical'') types. In other cases, the C
>standard makes few guarantees.
I find I must offer my apologies to readers of this newsgroup. I
The _actual_ rules in cases like these are given in section 6.3 (final
paragraph) of the ISO/ANSI C standard.
My own statements were based upon the rules given in section 184.108.40.206
(Semantics, second paragraph), but these seem to apply only in some
limited cases involving unions and not to the general case of
non-identical-type aliasing which can be achieved (in C) via pointer
As two respondants have pointed out to me (in private E-mail) my
assertions about permissible optimizations on the code sample shown
above _would have beeen true_ if I had just used the type `float' or
some other type in place of the type `char' everywhere in my example.
(Section 6.3, last paragraph contains a special dispensation for
`character types' in particular, and allows any object, or part
thereof, to be accessed via an lvalue having some character type.)
My thanks to Ray Hayes <email@example.com> and Volker Barthelmann
<firstname.lastname@example.org> for calling my attention to my error.
-- Ron Guilmette, Roseville, CA -------- Infinite Monkeys & Co. ------------
---- E-mail: email@example.com ----------- Purveyors of Compiler Test Suites -
Return to the
Search the comp.compilers archives again.