www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/01/29/12:41:40

Date: Wed, 29 Jan 2003 19:38:54 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp AT delorie DOT com
Message-Id: <7263-Wed29Jan2003193854+0200-eliz@is.elta.co.il>
X-Mailer: emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9
In-reply-to: <3E37FAD5.4113C82A@yahoo.com> (message from CBFalconer on Wed, 29
Jan 2003 16:42:54 GMT)
Subject: Re: Power at compilation time
References: <GpPY9.47960$ZE DOT 1351359 AT twister2 DOT libero DOT it> <kEsZ9.9753$wL1 DOT 5596 AT fe01>
<b15mdc$jhc$1 AT murdoch DOT hpl DOT hp DOT com> <SVAZ9.9887$wL1 DOT 3638 AT fe01>
<b17arb$qqa$1 AT elf DOT eng DOT bsdi DOT com> <3E37420D DOT 922C5B16 AT yahoo DOT com>
<b18mrj$t1q$07$1 AT news DOT t-online DOT com> <Pine DOT LNX DOT 4 DOT 33 DOT 0301291505010 DOT 736-100000 AT linux01 DOT gwdg DOT de> <3E37FAD5 DOT 4113C82A AT yahoo DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: CBFalconer <cbfalconer AT yahoo DOT com>
> Newsgroups: comp.lang.c,comp.os.msdos.djgpp
> Date: Wed, 29 Jan 2003 16:42:54 GMT
> > 
> > > What version of gcc are you using, and what flags? With gcc 3.2
> > > on a x86 GNU/Linux system and -O2 optimization, this code
> > >
> > >    #include <string.h>
> > >    size_t foo (const char *s) { return strlen (s); }
> > >
> > > generates `repnz scasb' as the loop to scan for the '\0'
> > > character.
> 
> Not here.  Under DJGPP, gcc 3.2.1 with:
> 
>     gcc -W -Wall -ansi -pedantic -gstabs+ -O2 -Wa,-alhn=strlgh.s
> strlgh.c
> 
> gives the following listing with the stabs lines deleted (long
> lines, thus pasted as quote):
> 
> -minline-all-stringops doesn't bring in any scasb sequences
> either.

I'd say GCC 3.2.1 is broken in this respect, and suggest to report
that to the GCC bug-reporting list.  The GCC docs clearly says that
string functions such as strlen are inlined by default.

> (All this may have more to do with the library than gcc)

No, compiler optimizations such as this one have nothing to do with
the library.  The only part of the library that the compiler sees is
the header files included by the program it compiles.

- Raw text -


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