The `shared` layout qualifier means that the layout of a particular set of variables in a block will be identical, so long as all blocks share the same definition. However, this does *not* mean that all of the members of a `shared` block are considered "active". Which means that you aren't guaranteed to be able to query the full layout for such a block from any program you compile that uses the shared block.
This is not a phantasmal issue; it is real and is really affecting code. NVIDIA's current drivers apparently will not consider shared uniforms active unless they're used. And the specification seems to allow this. See here for details: http://www.opengl.org/discussion_boards/showthread.php/181747-Nvidia-319-320-drivers-and-shared-layout-UBOs
The specification should *not* permit this.
I believe this related to something we have been recently working on internally, and will update here once that's confirmed and with the result.