Re:When you see a Heisenbug in C, change your compiler's opt...
by derefr on Saturday March 01, 2014 @06:43PM
(#7326763)
Indeed, if you re-interpret the article's usage of the phrase "optimizer bug", then the advice becomes useful: if changing the optimization level fixes your broken code, you have an undefined-behavior bug.
[ Parent
| on HN ]
Re:When you see a Heisenbug in C, change your compiler's opt...
by Eiwatah4 on Saturday March 01, 2014 @07:04PM
(#7326875)
Either that, or a race condition.
Re:When you see a Heisenbug in C, change your compiler's opt...
by johnbender on Saturday March 01, 2014 @07:24PM
(#7326976)
I'm not sure that's necessarily the case. See my comment above about sequential consistency.
Re:When you see a Heisenbug in C, change your compiler's opt...
by ben0x539 on Saturday March 01, 2014 @08:23PM
(#7327194)
Aren't those undefined behavior bugs?
Re:When you see a Heisenbug in C, change your compiler's opt...
by Dylan16807 on Saturday March 01, 2014 @11:12PM
(#7327680)
Imagine two threads that safely lock a resource, increment it, copy the value, and then unlock it. This is entirely defined, but also a race condition.
Race conditions are a lot like unsanitized input. They don't cause problems by themselves, but if you make incorrect assumptions it's easy to write incorrect code.