How to render a solid Alpha Mask?

How to render a solid Alpha Mask?

Level:
A Cube on a plane.

I want to output two alpha masks:

  1. a solid alpha mask from the cube
  2. a solid alpha mask from the plane

Currently, I am using the Stencil Layer for masking.

It looks like, it’s broken and the masking doesn’t work.
Result of the alpha channel:

Is it a bug or am I missing something essential here?
Thx.