Author: regehr

  • Introduction to Precision Farming

    [My father, David Regehr, encouraged me to write this piece, provided some of its content, edited it, and agreed to let me use data from his farm.] [For readers outside the USA: Alas, we do not farm in metric here. In case you’re not familiar with the notation, 10″ is ten inches (25.4 cm) and…

  • Zion NP and Environs in Winter

    As we enter faculty and grad recruiting season, I’d like to present a bit of Utah propaganda. No heroics are required to see this stuff: just a few hours driving from Salt Lake City (on pavement) and some mild day hiking. I’ll provide detailed instructions for visiting any of these locations upon request.

  • Testing LLVM

    [This piece is loosely a followup to this one.] Background Once a piece of software reaches a certain size, it is guaranteed to be loosely specified and not completely understood by any individual. It gets committed to many times per day by people who are only loosely aware of each others’ work. It has many…

  • A Tourist’s Guide to the LLVM Source Code

    In my Advanced Compilers course last fall we spent some time poking around in the LLVM source tree. A million lines of C++ is pretty daunting but I found this to be an interesting exercise and at least some of the students agreed, so I thought I’d try to write up something similar. We’ll be…

  • Undefined Behavior: Not Just for Programming Languages

    This is an oldie but goodie. Start with this premise: a = b Multiply both sides by a: a2 = ab Subtract b2 from both sides: a2 – b2 = ab – b2 Factor the left side: (a + b)(a – b) = ab – b2 Factor the right side: (a + b)(a – b)…

  • Principles for Undefined Behavior in Programming Language Design

    I’ve had a post with this title on the back burner for years but I was never quite convinced that it would say anything I haven’t said before. Last night I watched Chandler Carruth’s talk about undefined behavior at CppCon 2016 and it is good material and he says it better than I think I…

  • Vigorous Public Debates in Academic Computer Science

    The other day a non-CS friend remarked to me that since computer science is a quantitative, technical discipline, most issues probably have an obvious objective truth. Of course this is not at all the case, and it is not uncommon to find major disagreements even when all parties are apparently reasonable and acting in good…

  • Advanced Compilers Weeks 3-5

    This continues a previous post. We went through the lattice theory and introduction to dataflow analysis parts of SPA. I consider this extremely good and important material, but I’m afraid that the students looked pretty bored. It may be the case that this material is best approached by first looking at practical aspects and only…

  • Advanced Compilers Weeks 1 and 2

    This post will be of somewhat narrow interest; it’s a quick attempt to take my lecture notes for the first weeks of an advanced compilers course and turn them into something a bit more readable. I’m not using slides for this class. Motivation The great thing about an advanced course (on any topic) is that…

  • Solutions to Integer Overflow

    Humans are typically not very good at reasoning about integers with limited range, whereas computers fundamentally work with limited-range numbers. This impedance mismatch has been the source of a lot of bugs over the last 50 years. The solution comes in multiple parts. In most programming languages, the default integer type should be a bignum:…