I had to edit the original post because I over-simplified the problem. Sorry about that!
However, I'm not certain it's even worthwhile checking these kinds of things with anything less than a 5.10 compiler. In fact, I thought had a solution to this problem with 5.9.2, but 5.10 made it harder!