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

            Bug ID: 118477
           Summary: Race condition in 'd' Make-lang.in
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: clyon at gcc dot gnu.org
  Target Milestone: ---

In our CI with highly parallel builds, we have noticed random failures in the
'd' front-end, with errors like:
mv: cannot stat 'd/.deps/package.TPo': No such file or directory

My analysis is that the problem is caused by identical filenames in different
subdirs:
common/file.d
mangle/package.d
visitor/package.d
root/file.d

Make-lang.in contains for instance:
d/visitor-%.o: d/dmd/visitor/%.d
        $(DCOMPILE) $(D_INCLUDES) $<
        $(DPOSTCOMPILE)

which means that in DCOMPILE, we have $@ == d/visitor-package.o (which is OK)
but in DCOMPILE and DPOSTCOMPILE, we have $(@D) == 'd' and $(*F) == 'package'

so, while mangle/package.d and visitor/package.d have different targets
(d/mangle-package.o and d/visitor-mangle.o), their deps (.TPo) file is
identical: d/.deps/package.TPo

since DCOMPILE and DPOSTCOMPILE are present in other Make-lang.in instances,
I'm not sure it's OK to modify them.

OTOH, a simple fix is to make sure there are no files with the same names in
such subdirs, but how would we enforce that in the long term?

Reply via email to