lec 23: undefined behavior

administrivia

Thursday: hw4 due

Friday: wrapup / Q&A

next Monday: Q&A (560)

next Wednesday: final exam, open book/notes/laptop

most time-consuming bugs

memory bugs: dangling pointer, double free, “&var” vs “var”, leak (“800 valgrind warnings”), null pointers (“3 days”), variable lifetime (“1 week”)

logical bugs: wrong functions (“getnameinfo”), wrong variables (“head” vs “header”), wrong seek offset/count

others: missing semicolons, missing parentheses, size_t vs uint32_t, performance bugs, “no idea what happened”

ex19 quotes

The[re] are so many bugs in CSE333 that drove me crazy.

I’ve tried my best to repress most of the pain this class has caused me…

undefined behavior

  • can lead to unstable code: intended code altered by compilers due to undefined behavior
    • useful code unexpectedly gone
    • not a compiler bug: legal optimizations
    • not a spec bug: spec allows anything to happen
  • joint work with Nickolai Zeldovich, Frans Kaashoek, Armando Solar-Lezama