TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jasen Betts
from: Tulipant Gergely
date: 2003-06-16 09:49:00
subject: gcc -O

Jasen Betts -> Tulipant Gergely >>gcc -O<< {at} 10 Jun 03  06:46:06

 JB>>> FCBBX: Citizen David advise status of preparation of the device
 JB> "random" nonsesne
   What for? Is that some kind of pseudo
anti-anti-anti-anti-anti-anti-terorrist radar jammer?

 TG>> Could y'all test with some other version

 JB> K, I;ce got 3 different versions here, 2 Redhat abd one "DJ"

  Don't type _and_ drive. :P
  I meant please share the result with me. ;)

Jasen Betts -> Tulipant Gergely >>gcc -O<< {at} 10 Jun 03  06:52:09

 TG>> #include 
 TG>> int main(void) {
 TG>> puts("foo");
 TG>> return 0;
 TG>> }

 TG>> That "addl $16, %esp" is pretty useless before
"leave", and -O2 does
 TG>> eliminate it. Again, more is less

 JB> yeah.
 JB> with my DJGPP (GCC2.8.1) -O1 does that.

  Does what? addl?

 JB> I'm trying to figure out why 32 bytes are reserved on the stack....

  That, too.

 JB> must be a linux thing.

  I don't think so. Looks to me like a stack alignment bug. :(
-mpreferred-stack-boundary=4 is the default.

gcc -O0 -S -o - test.c -mpreferred-stack-boundary=4
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        subl    $12, %esp
        pushl   $.LC0
        call    printf
        addl    $16, %esp
        movl    $0, %eax
        leave
        ret

*
gcc -O0 -S -o - test.c -mpreferred-stack-boundary=2
main:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   $.LC0
        call    printf
        addl    $4, %esp
        movl    $0, %eax
        leave
        ret

*
gcc -O0 -S -o - test.c -mpreferred-stack-boundary=8
main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $248, %esp
        subl    $252, %esp
        pushl   $.LC0
        call    printf
        addl    $256, %esp
        movl    $0, %eax
        leave
        ret

-$248-$254? What the heck? How on earth will subl align on 2^8 boundary? It
needs /and/ as far as I know.

--- SkyReader/Linux v1.01a-7
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)
SEEN-BY: 633/267 270
@PATH: 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.