News for hackers. Stuff that matters.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by Thiez on Thursday August 19, 2021 @10:17AM (#28234127)
The C++ standard allows compilers to assume that loops terminate. Since there is only one way to exit the loop (`return true;`) the compiler can assume that this line will eventually be reached. Since the rest of the loop has no side effects, the compiler can optimize it out.

So the compiler doesn't actually need to figure out if the loop is infinite or not.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by Denvercoder9 on Thursday August 19, 2021 @10:59AM (#28234674)
> The C++ standard allows compilers to assume that loops terminate.

Technically, it doesn't, but it requires programs to make forward progress, which is defined as either terminating, calling I/O functions, accessing a volatile variable or performing an atomic or synchronization operation. Infinite loops that'll eventually do one of these are perfectly valid C++ and don't have to terminate.

Re:“Pack it in, mathematicians, someone owes LLVM a million ... by HelloNurse on Thursday August 19, 2021 @11:31AM (#28235134)
It optimizes "waste an unpredictable time doing arithmetic without side effects, then return 1" to "return 1 without looking at the input". The relation between that machine arithmetic and the Collatz conjecture is irrelevant.
Re:“Pack it in, mathematicians, someone owes LLVM a million ... by Denvercoder9 on Thursday August 19, 2021 @11:57AM (#28235468)
I don't think you're responding to the right comment?