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

            Bug ID: 87121
           Summary: wrong 128-bit integer multiplication with mixed bit
                    size
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpreda at gmail dot com
  Target Milestone: ---

Created attachment 44613
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44613&action=edit
repro source

Ubuntu 18.04.1
Linux x2 4.15.0-32-generic #35-Ubuntu SMP Fri Aug 10 17:58:07 UTC 2018 x86_64
x86_64 x86_64 GNU/Linux

On g++7 and g++8:

g++ (Ubuntu 7.3.0-16ubuntu3) 7.3.0

g++-8 (Ubuntu 8-20180414-1ubuntu2) 8.0.1 20180414 (experimental) [trunk
revision 259383]

In some special context which seems to include as relevant:
- an include of <cmath>
- using namespace std;

the integer multiplication 128-bit times 64-bit produces incorrect result.
See attached small repro case.

Expected output (see attached source): all 1.
Observed output:
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

Reply via email to