http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52304
--- Comment #2 from Vinicius Tinti <viniciustinti at gmail dot com> 2012-02-18 09:54:19 UTC --- Hello Jonathan, Sorry my mistake, I forget to remove the build folder content. There are only things generated by CMake. Please just do rm -rf build/* and try to run CMake again inside the build folder. Thus: rm -rf build/* cd build cmake .. make The only important files are: test.c test_included.c test_included.h test_not_included.c test_not_included.h. CMake does not allow you to change the path of the project after running it. So it is necessary to clean the build folder. Another very strange point is that if you run the code inside valgrind it works like a charm. In gdb it crashes also. Regards, Vinicius ==6562== Memcheck, a memory error detector ==6562== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==6562== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info ==6562== Command: ./main ==6562== b0 [OK] ==6562== Warning: set address range perms: large range [0x393ce040, 0x793ce040) (undefined) ==6562== Warning: set address range perms: large range [0x393ce030, 0x793ce050) (noaccess) b1 [OK] b2 [OK] ==6562== Warning: set address range perms: large range [0x393ce040, 0x793ce040) (undefined) ==6562== Warning: set address range perms: large range [0x393ce030, 0x793ce050) (noaccess) b3 [OK] ==6562== ==6562== HEAP SUMMARY: ==6562== in use at exit: 0 bytes in 0 blocks ==6562== total heap usage: 4 allocs, 4 frees, 2,147,485,696 bytes allocated ==6562== ==6562== All heap blocks were freed -- no leaks are possible ==6562== ==6562== For counts of detected and suppressed errors, rerun with: -v ==6562== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)