[Bug middle-end/125817] __builtin_popcountg() doesn't work for large _BitInt()
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 16 14:45:31 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125817
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
Component|c |middle-end
--- Comment #1 from Drea Pinski <pinskia at gcc dot gnu.org> ---
This union:
union ln {
unsigned _BitInt(256) ln;
unsigned _BitInt(1) e[256];
};
Does not do what you think it does.
`unsigned _BitInt(1)` has 7bit padding.
So when you do:
l.e[5] = true;
l.e[4] = true;
l.e[2] = true;
l.e[7] = true;
l.e[20] = true;
l.e[30] = true;
l.e[60] = true;
l.e[77] = true;
It does not set bit 6, 4,2, etc. but rather 5*8, 4*8, 2*8, etc. bit of the
whole union.
More information about the Gcc-bugs
mailing list