> There was similar discusion maybe month ago. I just found it, sorry that I didn't dig a little bit deeper. > GCC just tries to align everything to 16 bytes boundary(this > optimization is very "cheap" by the way), but if you need exact > behavior then you should use -mpreferred-stack-boundary, more info > you'll find: > http://gcc.gnu.org/onlinedocs/gcc-3.4.3/gcc/i386-and-x86_002d64-Options.html > (-mpreferred-stack-boundary) Ok, I've read the thread and the chapter in the manpage. This explains much, thanks alot for your help. But I've further question that were not answered. I'm still working with the example from my first post: (gdb) list 1,14 1 #include <string.h> 2 void f( char *args) { 3 char buf1[10]; 4 char buf2[4] = "ABC"; 5 strcpy (buf1, args); 6 } 7 8 int main (int argc, char *argv[]) { 9 if (argc > 1) { 10 printf("Input: %s\n", argv[1]); 11 f(argv[1]); 12 } 13 return 0; 14 } (gdb) break 6 Breakpoint 3 at 0x80483e4: file s1.c, line 6. (gdb) run `python -c 'print "A"*9'` Starting program: /mnt/data/studium/vi/rlp/bo/s1 `python -c 'print "A"*9'` Input: AAAAAAAAA Breakpoint 3, f (args=0xbffff3cc "AAAAAAAAA") at s1.c:6 6 } (gdb) x/12x buf2 0xbffff174: 0x00434241 0x41414141 0x41414141 0x08040041 0xbffff184: 0xbffff198 0xbffff198 0x0804841a 0xbffff3cc 0xbffff194: 0xbffff3cc 0xb7fd617c 0xb7eb6fa8 0x00000002 (gdb) info frame 0 Stack frame at 0xbffff190: eip = 0x80483e4 in f (s1.c:6); saved eip 0x804841a called by frame at 0xbffff1a0 source language c. Arglist at 0xbffff188, args: args=0xbffff3cc "AAAAAAAAA" Locals at 0xbffff188, Previous frame's sp is 0xbffff190 Saved registers: ebp at 0xbffff188, eip at 0xbffff18c (gdb) It says saved ebp is at 0xbffff188. The value there is 0xbffff198. But on the other hand, it says "called by frame at 0xbffff1a0". Shouldn't this be the same value? And it seems like ebp is saved two times, at 0xbffff184 and at 0xbffff188? I would expect the saved eip at 0xbffff188, but it is at 0xbffff18c. Can someone explain this behaviour, please? Daniel Hepper