LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] gcc optimizations

[ILUG] gcc optimizations

Caolan McNamara Caolan.McNamara at ul.ie
Fri Aug 20 12:30:26 IST 1999


I was wondering about strlen and string literals with gcc earlier on.
so i decided to do a little test. 

with gcc i.c where i.c is 
int main(void)
    {
    int i = strlen("test");
    return(i);
    }

with no optimization gcc calls strlen, but with optimization turned on
gcc converts the strlen call on the literal "test" directly into the
value 4, which made my day, coz it was what i hoped to see. cute eh..
main:
    pushl %ebp
    movl %esp,%ebp
    movl $4,%eax
    movl %ebp,%esp
    popl %ebp
    ret

But what i wondered was, if there was a list of what gcc does to optimize
anywhere, or it is just a hodgepodge of magic rules that you have to trawl
through experimentation or the gcc source to determine.

C.

Real Life: Caolan McNamara           *  Doing: MSc in HCI
Work: Caolan.McNamara at ul.ie          *  Phone: +353-86-8790257
URL: http://www.csn.ul.ie/~caolan    *  Sig: an oblique strategy
Faced with a choice, do both




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell