https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71813
Bug ID: 71813 Summary: fprintf/printf function exception Product: gcc Version: 4.9.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: szhebin at yahoo dot com Target Milestone: --- I wrote a program: #include <string.h> #include <stdio.h> char *test2() { char testArray[2]; char *testP; memcpy(testArray, "2", 2); testP = testArray; return testP; } char *test() { return test2(); } int main() { char *ret; ret = test(); fprintf(stdout, "%s\n", ret); return 0; } but, when I ran it, it output some things that people cannot understand. such as:'�d/ when I changed fprintf to printf, it output NULL. then, I use gdb-7.10.1 to check it, I could know: before fprintf/printf, the value of ret is correct. but after fprintf/printf, it went wrong.