Re: [PLUG] gcc, assembly, etc...

mike.h on 2003年2月20日 00:52:05 -0500


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] gcc, assembly, etc...


Using your functions, my results vary slightly, but are no less
peculiar: 
$ grep -A1 sub ex9f
 subl 4,ドル %esp
 movb 1,ドル -1(%ebp)
--
 subl 4,ドル %esp
 movb 1,ドル -1(%ebp)
--
 subl 24,ドル %esp
 movb 1,ドル -22(%ebp)
--
 subl 4,ドル %esp
 movb 1,ドル -1(%ebp)
--
 subl 24,ドル %esp
 movb 1,ドル -20(%ebp)
--
 subl 24,ドル %esp
 movb 1,ドル -19(%ebp)
--
 subl 24,ドル %esp
 movb 1,ドル -18(%ebp)
--
 subl 8,ドル %esp
 movb 1,ドル -1(%ebp)
--
 subl 24,ドル %esp
 movb 1,ドル -16(%ebp)
--
<snip>
On Wed, 2003年02月19日 at 22:58, Greg Lopp wrote:
> Additional mystery : 
> void f_1(void) { char car[1]; car[0] = 1;}
> void f_2(void) { char car[2]; car[1] = 1;}
> void f_3(void) { char car[3]; car[2] = 1;}
> void f_4(void) { char car[4]; car[3] = 1;}
> void f_5(void) { char car[5]; car[4] = 1;}
> void f_6(void) { char car[6]; car[5] = 1;}
> void f_7(void) { char car[7]; car[6] = 1;}
> void f_8(void) { char car[8]; car[7] = 1;}
> void f_9(void) { char car[9]; car[8] = 1;}
> 
> $ gcc -O0 -S bar.c
> $ grep movb bar.s
> 	movb 1,ドル-1(%ebp)
> 	movb 1,ドル-1(%ebp)
> 	movb 1,ドル-2(%ebp)
> 	movb 1,ドル-1(%ebp)
> 	movb 1,ドル-4(%ebp)
> 	movb 1,ドル-3(%ebp)
> 	movb 1,ドル-2(%ebp)
> 	movb 1,ドル-1(%ebp)
> 	movb 1,ドル-4(%ebp)
> 
> There are no other differences between these functions....
> f_1:
> 	pushl %ebp
> movl %esp,%ebp
> subl 24,ドル%esp
> movb 1,ドル-1(%ebp)
> leave
> 	ret
> 
> 
> 
> 
> _________________________________________________________________________
> Philadelphia Linux Users Group -- http://www.phillylinux.org
> Announcements - http://lists.netisland.net/mailman/listinfo/plug-announce
> General Discussion -- http://lists.netisland.net/mailman/listinfo/plug
-- 
-mike.h
_________________
mike.h@acm.org
mike.h@stemik.com
__________________________________________
Democracy is the worst form of government; 
except for all those other forms that have 
been tried from time to time.
-Winston Churchill
__________________________________________
GnuPG public key:
//http://www.stemik.com/~mike.h/mike.h.asc

Attachment: signature.asc
Description: This is a digitally signed message part




AltStyle によって変換されたページ (->オリジナル) /