Mail Archives: djgpp-workers/2003/01/18/19:30:13
Leonid Pauzner wrote:
> 11-Jan-2003 23:33 Marcel Cox wrote:
>
> > 3) Except for Pentium4, GCC 3.2.1 does not inline the strlen
> > function in your code as it considers the gain to be not
> > worthwhile. You can however force it to do so anyway by using
> > the option -minline-all-stringops and see if that makes a
> > difference.
>
> Apparently, gcc 3.2.1 __builtin_strlen() never inlined on
> Pentium 90MHz so the following function hangs:
I tried the following and got no hangs, but nothing seems to cause
the very simple inline string instructions to be used. Running on
a 486, gcc 3.2.1. I am surprised, because I found earlier that
memcpy() does use them.
/* Compile with -Wa,-alhn=strlgh.s to show code generated */
/* also try -minline-all-stringops */
#include <stdio.h>
#include <string.h>
char *s = "This is a string";
int main(int argc, char *argv[])
{
int lgh;
lgh = strlen(s);
printf("%d %s\n", lgh, s);
if (argc)
while (--argc) {
lgh = strlen(argv[argc]);
printf("%d %s\n", lgh, argv[argc]);
}
return 0;
}
--
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
- Raw text -