Stack Boundary

Sun Aug 18 06:57:00 GMT 2013

Using GCC 4.7.2 in MINGW.

Cannot figure out the code generated for " 
-mpreferred-stack-boundary=7".  If you understand the generated code, 
please explain.

I compiled a sample program I wrote (attached), disassembled it, and 
looked at the important instruction "sub esp,ALIGN_CONSTANT" in each of 
the functions.

With a -mpreferred-stack-boundary setting of 7, that means each function 
should be aligned to 128 bytes, or 0x80 bytes.

But these are the results of ALIGN_CONSTANT


I would think ALIGN_CONSTANT should be closer to 128 minus a small value 
for all 3 functions.  But 0x178 and 0x8c?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CallingConventions.tar.gz
Type: application/gzip
Size: 939 bytes
Desc: not available
URL: <>

More information about the Gcc-help mailing list