Red Hat EL6.1 $ g++ --version g++ (GCC) 4.4.5 20110214 (Red Hat 4.4.5-6) $ ccache --version ccache version 3.1.6 --- >8 --- >8 --- /* test.cpp */ #include <string> #include <stdio.h> void foo() { std::string path; path.erase( path.find_last_not_of("/\\")+1 ); printf(" // bigfoo 1\n"); } --- >8 --- >8 --- $ ccache g++ -c test.cpp $ strings -a test.o | grep // // bigfoo 1 Now, modify test.cpp to say "mytest" instead of "bigfoo" $ ccache g++ -c test.cpp $ strings -a test.o | grep // // bigfoo 1 It should say "mytest" but it says "bigfoo" instead. The object file is not re-generated. I also tried ccache 3.1.7 from fedora http://koji.fedoraproject.org/koji/buildinfo?buildID=282043 but the bug remained. I also tested this on OS X SnowLeopard but the bug did not exhibit itself there: $ g++ --version i686-apple-darwin10g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3) Could it be related to the compiler?
Thanks for the report! It's a ccache bug which should be fixed in commit 554a368a506365e05be0a9c1f7d09bf7e5ebd745, which will be included in ccache 3.1.8.
Fix included in v3.1.8.