If an UB adopt X behavior one time, a reproducible build will take same X behavior the next time.
Of course I am not negating the fact that this undefined in the first instance nor condoning the UB usage.
If an UB adopt X behavior one time, a reproducible build will take same X behavior the next time.
Of course I am not negating the fact that this undefined in the first instance nor condoning the UB usage.
It isn't a bug in the compiler if the compiler is non-deterministic in the presence of UB. Such behavior does not violate any guarantee provided by the compiler or language spec.
In fact, it's still not a bug if the compiler is non-deterministic, full stop. Many (most?) compilers have non-deterministic behavior due to a variety of factors. To get a sense of what's involved in getting determinism, look up some articles on why it's difficult to get reproducible builds working. It's a lot harder than it might seem at first.
"Sometimes gcc will opt to use a randomized model to guess branch probabilities, when none are available from either profiling feedback (-fprofile-arcs) or __builtin_expect. This means that different runs of the compiler on the same program may produce different object code." (from the gcc manual)