Undefined behavior in the wild

So I was hacking an open source C++ project. The project builds using gcc v5.4 and runs without problems. Then, I grabbed gcc v6.2 to see how much performance improvement can be gained. Surprisingly, the program segfaulted ...