I find this interesting, but for another reason than what the authors probably intended: the guy, who is presented as the "dumb" one (after a while the invisible interviewer is even making jokes about him), actually shows what many people would think intuitively would happen in their C code, so he is a good guideline for a compiler that wants to take that into account.
Either a brand new compiler or an existing compiler like gcc/clang that adds a new flag that performs its regular optimizations as long as they wouldn't break common assumptions about what their C code would do. Of course it would be hard to find these assumptions, but the linked presentation is a good start.
Personally if i was to do something like this i'd use a simple rule: what would be the dumbest, most straightforward way to implement a C compiler? What effect would some expression have in that compiler? Then this is what the "unsurprising" compiler mode should do - perform any optimizations as long as they do not interfere with that effect.
I think it would be a win/win situation for compilers to do that: they'd get to play their performance game and also provide a surprise-free mode without fully abandoning performance.
Either a brand new compiler or an existing compiler like gcc/clang that adds a new flag that performs its regular optimizations as long as they wouldn't break common assumptions about what their C code would do. Of course it would be hard to find these assumptions, but the linked presentation is a good start.
Personally if i was to do something like this i'd use a simple rule: what would be the dumbest, most straightforward way to implement a C compiler? What effect would some expression have in that compiler? Then this is what the "unsurprising" compiler mode should do - perform any optimizations as long as they do not interfere with that effect.
I think it would be a win/win situation for compilers to do that: they'd get to play their performance game and also provide a surprise-free mode without fully abandoning performance.