Re:Undefined behavior in C is a reading error
by BruiseLee on Thursday May 20, 2021 @01:36PM
(#27224326)
The compiler is allowed to act as if this loop executes exactly 16 times. That means it could unroll and vectorize it for example.
[ Parent
| on HN ]
Re:Undefined behavior in C is a reading error
by vyodaiken on Thursday May 20, 2021 @03:16PM
(#27225737)
It is completely useless to allow compilers to assume false things about the code they generate.
Re:Undefined behavior in C is a reading error
by fooker on Thursday May 20, 2021 @06:33PM
(#27228266)
It’s not useless.
The assumption is not false if the program doesn’t have undefined behavior.
The assumption allows the code to be a few times faster.
To disallow this assumption would inhibit these optimizations.