https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92717

            Bug ID: 92717
           Summary: precompiled headers non-deterministic
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gnu.org at mrks dot info
  Target Milestone: ---

I found that introducing precompiled headers to my project causes ccache
lookups to fail. I tracked it down to the gcc output not being deterministic:

# /usr/bin/c++ -x c++-header -include test.hxx -o test.hxx.gch -c test.hxx.cxx
&& md5sum test.hxx.gch
3a0efb998351939f4ed8efcfce1c0015  test.hxx.gch
# /usr/bin/c++ -x c++-header -include test.hxx -o test.hxx.gch -c test.hxx.cxx
&& md5sum test.hxx.gch
d295cbe3613100e6d989e62e3aafad6c  test.hxx.gch

Both test.hxx and test.hxx.cxx are empty. The used gcc version is
9.2.1-9ubuntu2.

With clang (clang++ -cc1 test.hxx -emit-pch -o test.hxx.pch), the hashes match.

When compiling with save-temps, the ii and s files match.

As builds of regular C(++) files are deterministic (as expected), I suspect
that this might be a bug.

Reply via email to