<p dir="ltr">gcc support stack overflow, but I never try before. </p>
<p dir="ltr"><a href="http://gcc.gnu.org/onlinedocs/gcc-4.3.6/gcc/Code-Gen-Options.html#Code-Gen-Options">http://gcc.gnu.org/onlinedocs/gcc-4.3.6/gcc/Code-Gen-Options.html#Code-Gen-Options</a></p>
<p dir="ltr">-fstack-check<br>
Generate code to verify that you do not go beyond the boundary of the stack. You should specify this flag if you are running in an environment with multiple threads, but only rarely need to specify it in a single-threaded environment since stack overflow is automatically detected on nearly all systems if there is only one stack.<br>

Note that this switch does not actually cause checking to be done; the operating system must do that. The switch causes generation of code to ensure that the operating system sees the stack being extended. </p>
<div class="gmail_quote">在 2013年9月18日 上午6:22,"John Criswell" <<a href="mailto:criswell@illinois.edu">criswell@illinois.edu</a>>写道:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 9/17/13 5:18 PM, Greg Fitzgerald wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks for the quick replies!<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If you want dynamic detection, then Address Sanitizer (which is built into Clang) or SAFECode<br>
</blockquote>
Dynamic detection.  I tried with Address Sanitizer and no luck<br>
out-of-the-box.  I think it can detect stack-buffer-overflow (aka<br>
stack corruption), but not stack overflow.  I also tried running the<br>
code with ASan inside a pthread with heap-allocated memory for its<br>
stack, but since the pthread library itself is not instrumented, it<br>
did not detect the heap-buffer-overflow when the thread's stack<br>
overflows.<br>
</blockquote>
<br>
I think I misunderstood.  Are you asking about the case in which the stack is about to exceed the limit set by the operating system?  I assumed you were talking about stack buffer overflows.<br>
<br>
-- John T.<br>
<br>
______________________________<u></u>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a><br>
</blockquote></div>