Comment 3 for bug 722734

Nikodemus Siivola (nikodemus) wrote :

The problem isn't really in the equality optimizations. It's fine for the compiler to optimize them away.

What's wrong is that the compiler is also optimizing away references to the global variables -- which can be unbound.

If you look at IR1-CONVERT-VAR, you will see that it is already special casing for this eventuality when the value is unused. But as you discovered, being used is not sufficient as the destination may be deleted later. We should to convert all global variables that are not ALWAYS-BOUND using SYMBOL-VALUE/SYMBOL-GLOBAL-VALUE.