Subject: Gcc
From: [email-masked] (Holger Burkarth)

29 Nov 1998 05:25:00 -0800
Message-ID: <[email-masked]>
Reply-To: Holger Burkarth <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain
To: [email-masked]

Hi,

i have a little question, the normaly so good
gcc machine-code, is in any case not
so good, what is the reason ?

------ Source -------
void test2()
{
  const char* Tst="";

  if(Tst != NULL) printf(Tst);
}

$ gcc main.cpp -O2 -S

------ Output -------
..file"main.cc"
 # GNU C++ version egcs-2.91.57 19980901 (egcs-1.1 release)
 #  (i686-pc-cygwin32) compiled by GNU C version egcs-2.91.57 19980901
 #  (egcs-1.1 release).
 # options passed:  -mcpu=i486 -mno-stack-arg-probe -O2 -Wchar-subscripts
 # -Wcomment -Wimplicit -Wparentheses -Wreturn-type -Wunused
 # -Wuninitialized -Wshadow -Wwrite-strings -Waggregate-return -Winline
 # -fno-exceptions -fomit-frame-pointer -fverbose-asm
 # options enabled:  -fdefer-pop -fomit-frame-pointer -fcse-follow-jumps
 # -fcse-skip-blocks -fexpensive-optimizations -fthread-jumps
 # -fstrength-reduce -fpeephole -fforce-mem -ffunction-cse -finline
 # -fkeep-static-consts -fcaller-saves -freg-struct-return -fgcse
 # -frerun-cse-after-loop -frerun-loop-opt -fschedule-insns2
 # -fsjlj-exceptions -fcommon -fverbose-asm -fgnu-linker -fregmove
 # -foptimize-register-move -fargument-alias -m80387 -mhard-float
 # -mno-soft-float -mieee-fp -mfp-ret-in-387 -mschedule-prologue -mcpu=i686
 # -march=pentium

gcc2_compiled.:
___gnu_compiled_cplusplus:
..text
LC0:
..ascii "\0"
..globl _Test2__Fv

_Test2__Fv:
 movl $LC0,%eax
 testl %eax,%eax
 je L138             <- why this ?
 pushl %eax
 call _printf
 addl $4,%esp
L138:
 ret

--
Holger Burkarth
Software-Developer
[email-masked]
http://www.prodad.de

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".