https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89824
Bug ID: 89824 Summary: Variant jump table reserves space for __variant_cookie twice Product: gcc Version: 9.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: antoshkka at gmail dot com Target Milestone: --- Space for the `__variant_cookie` state is already reserved in _Multi_array `_Multi_array<_Tp, __rest...> _M_arr[__first + __do_cookie];`. Additionally reserving it inside the `__gen_vtable` produces jump table with gaps https://godbolt.org/z/Vx_wEU. Fix: remove the `+ (is_same_v<_Result_type, __variant_cookie> ? 1 : 0)` from `__gen_vtable`. This removes zeros from jump table and slightly reduces the binary size https://godbolt.org/z/gyo0-j