https://bugs.freedesktop.org/show_bug.cgi?id=66067
--- Comment #11 from Grigori Goronzy greg@chown.ath.cx ---
ARB_fragment_program_shadow may leave it undefined, but the GL spec ...
Which spec exactly? GL specifications only cover GLSL shaders. ARB_fragment_program is separate from that and has its own rules. The extension specification clearly states that behaviour is undefined.
Besides, OpenGL contradicts itself a little bit: in GL 4.4 spec, 15.2.1 it states that behaviour is undefined for this case, too. It makes much more sense anyway, shadow sampling is wildly different from sampling a texture normally in terms of what the sampling result look like.