Вопрос

I recently had a bug in a gentoo linux package: The code did not compile properly if it was compiled in several threads. Often people report problems with compilation in parallel make jobs in gentoo, where all programs were build from source.

This lead me to the question, if it is true in general, that the compiler should create the same binaries when compiling with a different number of threads? (like MAKEOPTS="-j1" or MAKEOPTS="-j9")

If the binaries may differ, will the optimization effort (-O2) be the same?

Это было полезно?

Решение

  1. Compilers are not multi-threaded.
  2. Compilers are deterministic. The same compiler run on the same source code with the same options should produce identical object code apart from timestamps.
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top