This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: SIMPLE: A language-independent tree IR
- From: Geoff Keating <geoffk at geoffk dot org>
- To: jbuck at synopsys dot com
- Cc: dalej at apple dot com, pkoning at equallogic dot com, toon at moene dot indiv dot nluug dot nl, gcc at gcc dot gnu dot org
- Date: Thu, 3 Jan 2002 13:27:22 -0800
- Subject: Re: SIMPLE: A language-independent tree IR
- References: <200201032041.MAA16057@atrus.synopsys.com>
- Reply-to: Geoff Keating <geoffk at redhat dot com>
> From: Joe Buck <jbuck@synopsys.com>
> Date: Thu, 3 Jan 2002 12:41:36 -0800 (PST)
> Cc: dalej@apple.com, pkoning@equallogic.com, toon@moene.indiv.nluug.nl,
> gcc@gcc.gnu.org
>
>
> > > And what of this case:
> > >
> > > T = foo (f(), (g(x), h(y)) )
> > >
> > > Is the call ordering g, f, h legal?
> > > Take a look at the example in 3.3.2.2 (c89) before you answer...
> >
> > I believe this issue was dealt with in C99. In C89, there was a
> > question as to even whether the instructions of f and g could be
> > interleaved; in C99, a more formal specification was adopted and I
> > believe the answer came out 'no'.
>
> Since we have the as-if rule, that's not quite the answer; we can only
> say that the visible side effects (accesses to volatile variables,
> calls to other functions that may have side effects) cannot be
> interleaved. If f, g, and h are inlined, we could have considerable
> freedom to do reordering despite the C99 rules.
Yes. What I actually meant was "In C89, there was a question as to
whether if f and g both change the same variable, undefined behaviour
ensues;"
An example of this is whether
int i;
int f() { i++; return 0; }
f() + f();
was undefined behaviour, because 'i' could be modified twice between
sequence points.
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>