It could be either a compiler bug, or a Mesa bug which only manifests itself with certain compiler options.