This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SIMPLE: A language-independent tree IR


> 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>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]