source file: #include <stdio.h> int main(void) { char a = 1; int b = 2; short c = 3; char sztmp[22] = "hello worlds!";
*(int *)&a=0xffff; sztmp[22]=0; printf("%s,a:%d,b%d\n",sztmp,a,b); return 0; } invoke gcc by :gcc -fstack-protector-all test.c; after my debugging a.out, I find the gcc doesn't adding a guard variable to functions's local stack vars, and the var "sztmp" follows var "a" and there aren't any room between the two vars. -- Summary: why the option "-fstack-protector-all" doesn't works? Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zuogang at huawei dot com GCC host triplet: x86, SUSE 10 ES, GCC target triplet: X86 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38274