I've committed a fix (to all supported branches, since this bug actually precedes the addition of GROUPING SETS and can be triggered with a simple GROUP BY if you try hard enough). The regression test says it works now, but it'd be good if you could try it again on REL_11_STABLE (at commit e74d8c5085 or later) to check that it fixes your case.
I checked on REL9_6_STABLE and REL_11_STABLE, and it works great. Thank a lot for the quick fix!