delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2006/04/06/05:00:29

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Sequence points, any?
Date: 6 Apr 2006 08:50:04 GMT
Lines: 24
Message-ID: <49k31sFovesfU3@news.dfncis.de>
References: <1144238453 DOT 674596 DOT 302360 AT z34g2000cwc DOT googlegroups DOT com> <200604051406 DOT k35E6iOx002313 AT envy DOT delorie DOT com> <1144285170 DOT 583086 DOT 24610 AT v46g2000cwv DOT googlegroups DOT com> <v1v832h6p1p2bn51mjva71bkg6aui4in9n AT 4ax DOT com>
X-Trace: news.dfncis.de aX1T26iL338nsSDs7ZDmmAlsYSXi8IgKwB8a649RFYlV6Gjt9Xti2AnA8r
X-Orig-Path: not-for-mail
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Brian Inglis <Brian DOT Inglis AT systematicsw DOT invalid> wrote:

> The compiler should not be rearranging the order of calls to external
> functions specified in separate statements, unless there were some
> other factors involved that it could infer. 

Well --- it's not rearranging calls to external functions, since Ack()
is not exactly an external function in the example case.  The only
calls to external functions are those to clock() and printf(), in that
example, and those are left in their original order.  The only strange
thing is that GCC apparently detected that Ack() and clock() were
independent jobs that could be done in parallel, since the result of
one could not possibly depend on whether the other was finished yet.
So it expanded Ack() inline (at least partially), and put the call to
clock right in the middle of it.  

Unfortunately, that detection is wrong for a function like clock().  I
may be going out on a limb there, but this could require a change to
the declaration of clock() and similar functions to forbid this kind
of optimization.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019