[Bug tree-optimization/126503] Wrong code with signed bitint

"jakub at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126503

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
All in one testcase:
[[gnu::noipa]] unsigned _BitInt(400)
foo (_BitInt(257) a)
{
  return (unsigned _BitInt(400)) (-a);
}

[[gnu::noipa]] unsigned _BitInt(300)
bar (_BitInt(7) a, unsigned _BitInt(17) b)
{
  _BitInt(257) x = (_BitInt(257)) a + -1;
  return ~((unsigned _BitInt(300)) x ^ (unsigned _BitInt(300)) b);
}

[[gnu::noipa]] _BitInt(129)
baz (_BitInt(129) x)
{
  return x - 24;
}

[[gnu::noipa]] int
qux (_BitInt(129) x, _BitInt(129) y)
{
  return x == y;
}

int
main ()
{
  if (foo (-1wb) != 1uwb)
    __builtin_abort ();
  if (bar (1wb, 3uwb) != (unsigned _BitInt(300)) -4wb)
    __builtin_abort ();
  if (!qux (baz (100), 76))
    __builtin_abort ();
}

Doesn't fail (nor #c0 nor #c1) on x86_64, neither -m64 -O2 nor -m32 -O2.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.