Classic Bug Reports

A bug report is sometimes entertaining either because of the personalities involved or because of the bug itself. Here are a collection of links into public bug trackers; I learned about most of these in a recent Twitter thread.

I hope you enjoy these as much as I do. Thanks to everyone who contributed links.

Updates from comments and Reddit:

Booster Test

Ever since learning that the space shuttle booster motors were manufactured and tested at ATK in Promontory Utah — not too far from where I live — I wanted to see one of the tests. I didn’t manage to do that before the shuttle program was shut down, but today I got to see something better: a test of an SLS booster, which is about 25% more powerful than an STS booster and more than twice as powerful as one of the big F-1 engines from the Saturn V.

Here’s a close-up video. On the other hand, this one shows what the test was like from the viewing area, in particular the 8 seconds it took the noise to reach us. The sound was very impressive, with enough low-frequency power to make my clothing vibrate noticeably, but it was not anywhere close to painfully loud. The flame was, however, painfully bright to look at. The nozzle was being vectored around during the test (I hadn’t realized that the solid rockets participate in guidance) but that wasn’t easy to see from a distance.

NASA socials give some inside access to people like me (and you, if you live in the USA and want to sign up next time) who have no official connection to the space program. Yesterday we got to tour the plant where the boosters are made. It was great to learn about techniques for mixing, casting, and curing huge amounts of propellant without getting air bubbles or other imperfections into the mix and without endangering workers. The buildings in this part of ATK have escape slides from all levels and are surrounded by big earthworks to deflect potential explosions upwards. It was also really cool to see the hardware for hooking boosters to the main rocket, for vectoring nozzles, and things like that. Alas, we weren’t allowed to take pictures on the tour.

ATK’s rocket garden at sunrise:

And the main event:

Inversions in Computing

Some computer things change very slowly; for example, my newish desktop at home has a PS/2 port. Other things change rapidly: my 2010 iPad is kind of a stone-age relic now. This kind of differential progress creates some funny inversions. A couple of historical examples:

  • Apparently at one point in the 80s or 90s (this isn’t a firsthand story– I’d appreciate recollections or citations) the processor available in an Apple printer was so fast that people would offload numerical computations to their printers.
  • I spent the summer of 1997 working for Myricom. Using the then-current Pentium Pro machines, you could move data between two computers faster than you could do a local memcpy(). I’m pretty sure there was something wrong with the chipset for these processors, causing especially poor memcpy() performance, but I’ve lost the details.

What are the modern examples? A few come to mind:

Anyhow, I enjoy computing inversions since they challenge our assumptions.

What I Accomplished in Grad School

I often talk to students who are thinking about grad school. The advice I generally give is a dressed-up version of “Just do whatever the hell will make you happy.” But if we all had solid ideas about what would make us happy then, well, we’d probably be a lot more happy. Here’s a list of things that I actually accomplished in grad school. Most of these things did make me happy or at least were satisfying. Of course, I cannot know the extent to which these things would make other people happy, and I also cannot know whether I would have been happier with the things that I’d have accomplished if I hadn’t gone to grad school. Since I got a PhD 13 years ago and started the program 18.5 years ago (crap!) I have at least a modest amount of perspective at this point.

First, some work-related things.

  • I became pretty good at doing and evaluating research.

  • I started to become good at writing. When I arrived at grad school I was not a good writer. When I left, I was not good either, but at least I was on the way. Since 2001, every time I write something, I have been thankful that it’s not a PhD thesis.

  • I wrote a few pretty decent papers. None of them set the world afire, but none of them has been a source of embarrassment either.

  • I did some internships in industry and, along the way, learned a bit about how the real world works, if such a thing can be said to exist.

But really, the things in grad school that weren’t about work were better:

  • I read a lot of books, often several per week. I’m afraid that I’m going to have to get the kids out of the house and also retire if I want to reach that level again.

  • I found someone to spend the rest of my life with. This was the purest luck.

  • I made a number of friends who I am still close to, though we don’t talk nearly often enough. I doubt that I’ll ever have another group of friends as good as these.

  • I became quite good at disc golf.

  • I did a decent amount of programming for fun.

  • I avoided going into debt. In fact, the TA and RA stipends that I received in grad school felt like a lot of money compared to the ~$7000/year that I lived on as an undergrad.

There are a bunch of things that are important that I did not accomplish in grad school:

  • I failed to learn even rudimentary time management.

  • I did not develop good eating, drinking, sleeping, or exercise habits. When I graduated I was under the impression that my body could tolerate almost any sort of abuse.

  • I didn’t learn to choose good research topics, this took several more years.

  • I didn’t figure out what I wanted to do with my life.

I put this out there on the off chance that it might be useful for people who are thinking about grad school.

Automatically Entering the Grand C++ Error Explosion Competition

G++ can be comically verbose; developers sometimes like to wallpaper their cubes with choice error messages from Boost or STL programs. The Grand C++ Error Explosion Competition asks the question: how large can we make the ratio between error output and compiler input?

I’m not much of a C++ person but when the contest was announced I was doing some experiments in using C-Reduce as way to search for C++ programs that have interesting properties. Of course, we usually use C-Reduce to search for small programs, but Alex and I have been using it (and other reducers) to find, for example, programs that cause interesting parts of the compiler to execute. It only took a minute or two to setup C-Reduce so that its goal was to maximize the GCEEC’s fitness function. I started it running on four C++ files; after a few days three of the reductions didn’t show signs of terminating but the fourth one — some random part of the LLVM backend — reduced to this:

struct x0 struct A<x0(x0(x0(x0(x0(x0(x0(x0(x0(x0(_T1,x0 (_T1> <_T1*, x0(_T1*_T2> 
binary_function<_T1*, _T2, x0{ }

Somewhat surprisingly, there aren’t any templates here. When compiled using G++ 4.8.1 (I’m using the one that comes with Ubuntu 13.10 on x86-64) we get 5 MB of output. It wasn’t too hard to (1) clean up this output a bit and (2) recognize that the repeated (x0 substring is important. Thus, my entry to the GCEEC was:

struct x struct z<x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(x(y,x(y><y*,x(y*w>v<y*,w,x{}

Every added (x approximately doubles the size of the error output. It was tricky to choose the right number of these substrings to include since I wanted to bump up against the timeout without pushing past it. But really, at this point the competition became a lot less interesting because we can pick a target ratio of output to input and trivially craft an input that reaches the target (assuming we don’t run into implementation limits). So the contest is basically a bandwidth contest where the question is: How many bytes can we get out of G++ on the specified platform within the 5 minute timeout? At this point the winner depends on how many cores are available, the throughput of Linux pipes, etc., which isn’t too satisfying.

I was a little bummed because I didn’t need to use a trick I had been saving up, which was to give the C++ file a name that is 255 characters long — this is useful because the name of the source file is repeated many times in the error output (and the length of the source file name is not part of the fitness function). However, it was delightful to read the other contest entries which used some nice tricks I wouldn’t have thought of.

Would it be fun to repeat this contest for Clang++ or MSVC++? Also, why is G++ so verbose? My guess is that its error reporting logic should be running (to whatever extent this is possible) much earlier in the compilation process, before templates and other things have been expanded. Also, it would probably be useful to enforce a limit on the length of any given error message printed by the compiler on the basis that nobody is interested in anything past the first 10 KB or whatever.

Sometimes Compilers are Cute

#include <stdint.h>

uint32_t foo1 (uint32_t x, int r)
{
  return (x << r) | (x >> (32 - r));
}

uint32_t foo2 (uint32_t x, int r)
{
  return (x >> r) | (x << (32 - r));
}

uint32_t foo3 (uint32_t x)
{
  return 
    (x << 24) | 
    ((x & 0x0000ff00) <<  8) |
    ((x & 0x00ff0000) >>  8) |
    (x >> 24);
}

uint32_t foo4 (uint32_t x)
{
  char *xp = (char *)&x;
  uint32_t y;
  char *yp = (char *)&y;
  yp[0] = xp[3];
  yp[1] = xp[2];
  yp[2] = xp[1];
  yp[3] = xp[0];
  return y;
}

regehr@john-home ~ $ clang -Os -S -o - foo.c
foo1:
	movb	%sil, %cl
	roll	%cl, %edi
	movl	%edi, %eax
	ret

foo2:
	movb	%sil, %cl
	rorl	%cl, %edi
	movl	%edi, %eax
	ret

foo3:
	bswapl	%edi
	movl	%edi, %eax
	ret

foo4:
	bswapl	%edi
	movl	%edi, %eax
	ret

regehr@john-home ~ $ gcc -Os -S -o - foo.c
foo1:
	movl	%edi, %eax
	movb	%sil, %cl
	roll	%cl, %eax
	ret

foo2:
	movl	%edi, %eax
	movb	%sil, %cl
	rorl	%cl, %eax
	ret

foo3:
	movl	%edi, %eax
	bswap	%eax
	ret

foo4:
	movl	%edi, -20(%rsp)
	movb	-17(%rsp), %al
	movb	%al, -4(%rsp)
	movb	-18(%rsp), %al
	movb	%al, -3(%rsp)
	movb	-19(%rsp), %al
	movb	%al, -2(%rsp)
	movb	-20(%rsp), %al
	movb	%al, -1(%rsp)
	movl	-4(%rsp), %eax
	ret

I’ve edited the asm to remove extraneous lines. I expect there’s probably a tweak I could use to get GCC to recognize the pointer-based endian swap but I didn’t find it.

According to Googer

This post is all Eddie’s fault.

Things that are exquisitely fortuitous

  • her sudden and unexpected departure with a drunken Hanes waving a gun
  • timing
  • positioning
  • several kinds of parameters of the universe
  • that they chose sh** to describe this newest of Beetoven’s competitors
  • that Phaidon, the British publisher, is issuing new editions of Ungerer classics, including “Moon Man”
  • the Boston bombing
  • mutations
  • a meteor strike landing on the venue of a future presidential debate

Exceedingly beautiful, yet …

  • frightfully poor
  • profoundly sad
  • whose beauty was her least charm
  • cruel at the same time
  • it seems not to rest upon solid masonry
  • Mary Howitt was–and you could not help but feel it–queen among them all
  • the sculptor proceeded with little pleasure
  • the soil is much thinner than that of the flat bottom land near the Mississippi
  • not one of the sailors responded to the offer
  • perfectly practical and becoming
  • in tropical scenery, the entire newness, & therefore absence of all associations, which in my own case (& I believe in others) are unconsciously much more frequent than I ever thought, requires the mind to be wrought to a high pitch, & then assuredly no delight can be greater; otherwise your reason tells you it is beautiful but the feelings do not correspond
  • in our opinion neither of them equals our old superb warbler or Blue Wren
  • she rubbed her face with pepper so as not to tempt anyone or take any focus from God
  • intellectually inept person
  • very aggressive
  • simple setting was designed for the Senior play
  • damaged
  • sad when an old campaigner reaches the twilight years
  • it never mattered

Things that are monumentally egregious

  • practices of the IRS
  • s*** you post
  • man-made errors and mistakes
  • displays
  • compensation
  • mismanagement
  • miscarriage of justice
  • mistakes in understanding
  • price-gouging
  • a betrayal of trust
  • crime
  • idiocy
  • errors
  • a blunder
  • their behavior
  • typos
  • the traffic on the way there
  • a failure of judgement
  • government censorship
  • gaps in logic
  • Steptacular or 5ive’s Greatest Hits
  • officiating blunders
  • exercise of power
  • ethical, moral and legal transgressions
  • operator error
  • the recent bank bailout bill [that] includes a provision which tacks on a $450 charge at closing for any residential real estate financing transaction
  • the behavior of Tech fans

Things that are too frightening to seriously consider

  • the thought of attempting to produce crops with these people
  • the prospect of walking away
  • that topic itself and the implications that follow
  • our sinfulness apart of comfort of the Cross
  • regard[ing] the Law as authoritative
  • the thought of quitting a career after over ten years of unquestionable success
  • the implications of Berger’s proposed ban
  • the thought of stepping off into independence
  • the implications of that finding
  • highly radioactive waste being perpetually stored on California’s seismically active coast

Funniest Computer Book?

The other day Eric Eide noticed The UNIX Hater’s Handbook on my desk and remarked that there aren’t enough funny computer books. This is undeniably true. So now I’m trying to find the funniest computer book and I’d appreciate some help. Here are a few guidelines:

So what’s left? Not that much, it seems. Here are a few ideas:

  • Mr. Bunny’s Guide to ActiveX — What even happened to ActiveX? Anyway, back in the day this was a pretty great parody of the kind of books you find in the programming section at Barnes and Noble.

  • The Computer Contradictionary — it’s The Devil’s Dictionary for computers (in fact the first edition was called The Devil’s DP Dictionary)

  • Dating Design Patterns — I haven’t read it but Eric says it’s funny

Thoughts? If you don’t have a suggestion, please just vote for something that I, or someone else, suggested.

Crashy Compiler Flags

This post is for fun, no deep thoughts will be presented. For a research project that’s not yet ready to write up, I needed a bunch real programs (as opposed to, for example, programs generated by Csmith) that cause compilers to crash. So I built a few hundred randomly chosen revisions of GCC and LLVM/Clang and then built about 1,700 packages from source on a 64-bit Ubuntu box using a “compiler interceptor” — a collection of aliases such as “gcc” and “g++” that lead to a script that eventually runs the intended compiler but first invokes a few of the random compiler versions. If one of the random compilers crashes, the interceptor saves enough information to reproduce the problem: basically the compiler command line and the preprocessed source file. Not counting a large number of trivial invocations by autotools, the compiler interceptor was called about 274,000 times, resulting in about 4,000 reproducible compiler crashes (about 2,000 crashes were not considered usefully reproducible by my scripts because, for example, gcc was being used as a linker or assembler).

Modern build systems are not very pretty and consequently compiler command lines are fat and redundant: during my compiling party, the compiler was invoked with a command lines up to about 20 KB long. To find out which arguments were leading to compiler crashes, I wrote a little delta debugger that iteratively attempted to remove arguments until a fixpoint was reached under the rule that we can only remove arguments that don’t make the crash go away. Additionally, this program attempted to downgrade the optimizer flags, for example turning -Os and -O3 into -O2, -O2 into -O1, etc. The tables below show the results ranked by number of occurrences in the ~4000 reproducible crashes.

When reading the results, keep a few things in mind:

  • Every option that is listed is actually needed to make the compiler crash. Why would -Wall induce a crash? I didn’t look into it but there must be a bug in the code emitting warnings.
  • These results don’t reflect the behavior of the current versions of GCC and LLVM/Clang, but rather the range of revisions that I tested. These are roughly GCC 4.0-current and LLVM/Clang 2.6-current. As the numbers show, clang++ was an extremely immature compiler early on; this of course doesn’t imply anything about the current quality of this compiler.

gcc

# crashes options
12 -O1
9 -O3
8 -Wall -O2
6 -Os -g -fno-asynchronous-unwind-tables
4 -O2
1 -std=gnu99 -O1
1 -std=gnu99 -O3
1 (none)

g++

# crashes options
147 (none)
13 -O1
3 -std=c++0x
2 -O3

clang

# crashes options
644 -mavx -O2
206 (none)
152 -mavx
63 -mavx -O1
58 -fexceptions
5 -fgnu89-inline -fexceptions
2 -O1 -fPIC
2 -fgnu89-inline -fPIC
1 -fgnu89-inline -g -fPIC
1 -fPIC
1 -O1
1 -O3
1 -Wall

clang++

# crashes options
2829 (none)
8 -std=c++0x
4 -std=c++0x -g
1 -Wall -std=c++0x
1 -g -O1
1 -g
1 -O1

One thing that comes to mind while looking at these results is that I’d have expected -O3 to show up more often.