public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98474] New: incorrect results using __uint128_t
@ 2020-12-29 21:57 jeffhurchalla at gmail dot com
  2020-12-29 22:17 ` [Bug c++/98474] " jeffhurchalla at gmail dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: jeffhurchalla at gmail dot com @ 2020-12-29 21:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98474

            Bug ID: 98474
           Summary: incorrect results using __uint128_t
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jeffhurchalla at gmail dot com
  Target Milestone: ---

g++ version: g++-10 (Ubuntu 10.1.0-2ubuntu1~18.04) 10.1.0
x64 CPU: Intel(R) Core(TM) i5-4570S CPU @ 2.90GH

Compile command used:
g++-10 -O3 -std="gnu++11" -v -save-temps -fsanitize=undefined -Wall -Wextra
-fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations test.cpp -o
testbug

It compiles cleanly for me, with no warnings or errors.  After compiling, I use
the following commands:
./testbug
echo $?

Echo prints 2 for me, but the result should be 0.
The preprocessed version of test.cpp is the same as the non-preprocessed
version.  It follows here:

__attribute__ ((noinline))
__uint128_t foo(__uint128_t& x)
{
    return x;
}

int main()
{
    using T = __uint128_t;
    T two65 = static_cast<T>(1) << 65;
    T two65_copy = two65;

    foo(two65_copy);
    T n = two65_copy;

    while (n >= two65)
        n -= two65;

    return static_cast<int>(n >> 64);
}

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-04-22 17:09 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29 21:57 [Bug c++/98474] New: incorrect results using __uint128_t jeffhurchalla at gmail dot com
2020-12-29 22:17 ` [Bug c++/98474] " jeffhurchalla at gmail dot com
2020-12-29 22:27 ` [Bug tree-optimization/98474] [8/9/10/11 Regression] " jakub at gcc dot gnu.org
2020-12-29 22:27 ` jakub at gcc dot gnu.org
2020-12-30 10:03 ` jakub at gcc dot gnu.org
2020-12-31  2:59 ` jeffhurchalla at gmail dot com
2020-12-31 10:07 ` cvs-commit at gcc dot gnu.org
2020-12-31 10:11 ` [Bug tree-optimization/98474] [8/9/10 " jakub at gcc dot gnu.org
2021-01-01  2:44 ` jeffhurchalla at gmail dot com
2021-01-05 10:44 ` rguenth at gcc dot gnu.org
2021-01-06  9:40 ` cvs-commit at gcc dot gnu.org
2021-01-06  9:46 ` [Bug tree-optimization/98474] [8/9 " jakub at gcc dot gnu.org
2021-04-20 23:31 ` cvs-commit at gcc dot gnu.org
2021-04-22 16:49 ` cvs-commit at gcc dot gnu.org
2021-04-22 17:09 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).