delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2006/03/28/14:30:49

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: "Bob W" <dontsend AT operamail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: new gcc 4.10 behaviour
Date: 28 Mar 2006 11:16:20 -0800
Organization: http://groups.google.com
Lines: 31
Message-ID: <1143573380.032350.9140@g10g2000cwb.googlegroups.com>
References: <1143542847 DOT 613686 DOT 87820 AT v46g2000cwv DOT googlegroups DOT com>
<48sjvaFlir4cU1 AT news DOT dfncis DOT de>
NNTP-Posting-Host: 84.102.38.180
Mime-Version: 1.0
X-Trace: posting.google.com 1143573388 26327 127.0.0.1 (28 Mar 2006 19:16:28 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Tue, 28 Mar 2006 19:16:28 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: g10g2000cwb.googlegroups.com; posting-host=84.102.38.180;
posting-account=CXf2IQ0AAADhHwR4LIBYSPHMQKV3cPd3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Good post, thanks!

This has finally forced me into checking the assembly
output and the following seems to occur:

Gcc creates its own global version of Ack(), which
is called either once or twice by main() - depending
on the supplied parameter value. Unfortunately
t1=clock() is executed before Ack() is eventually called
the second time by main().

There is no obvious performance reason why this is
happening, although it might have minor effects on
code size. But I have to admit that there is also no
reason to expect gcc to be in conformance with my
expectations.

At least I now think to understand why and how
timing of Ack() gets distorted by gcc's optimisation.
The only remidy to synchronize calls to Ack() and
clock() seems to be to assign the return value of Ack()
to either a global variable or declare "ackret" static.

The second phenomenon ("program terminates
without output") might be caused by a stack
overflow if the parameter value gets too high.

As for "to speed up things even more" - I have not
noticed any breathtaking speed improvements of
gcc 4.10 over previous versions.

- Raw text -


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