https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63393
Bug ID: 63393 Summary: -ffreestanding not work: memset call cause valgrind crash Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dushistov at mail dot ru Created attachment 33588 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33588&action=edit problem code On my system linux/x86_64 compilation of valgrind with -O3 -march=native cause crash of valgrind with any executable file. The problem is similar to http://llvm.org/bugs/show_bug.cgi?id=9795, vgPlain_memset call memset, memset call vgPlain_memset and so on. To simplify bug hunting I extract code to separate file, if compile it with: >gcc -O3 -march=native -ffreestanding -static -nodefaultlibs -nostartfiles >-ggdb test_memset.c gcc give error: undefined reference to `memset', but with "-O2" >>gcc -O2 -march=native -ffreestanding -static -nodefaultlibs -nostartfiles >>-ggdb test_memset.c all works fine. gcc 4.8.1