Fix uninitialized use of TIntermediate::resource (#2424)
TIntermediate was constructed without initializing any of the `resources` fields,
and `TProgram::linkStage()` was not calling `TIntermediate::setLimits()`
after constructing new `TIntermediate`s for non-first stages.
Fields of `resources` were then read in `TIntermediate::finalCheck()`
triggering undefined behavior.
This CL makes three changes:
(1) `TIntermediate::setLimits()` is now called for non-first stages by
copying the `firstIntermediate`'s limits. This ensures that the
`resources` fields is initialized, fixing the bug.
(2) `TIntermediate::resources` is now wrapped in a `MustBeAssigned<>`
helper struct, asserting in non-release builds that this field is
always initialized before reading.
(3) `TIntermediate::resources` is now zero-initialized, so that if
the `TIntermediate::resources` field is not set in a release build
(and so the `assert()` will be disabled) behavior is still
deterministic.
Fixes #2423