Bug#846530: g++-6: uint64_t toto=800*16'800'000; // -Woverflow reported
Package: g++-6
Version: 6.2.0-13
Severity: normal
Dear Maintainer,
This program fails:
``` c++
#include <cstdint>
int main()
{
uint64_t toto = 800*16'800'000; // *should* be 10'080'000'000
return 0;
}
```
when compiled with:
``` make
all:
g++ -Wall -std=c++14 main.cpp -o main.out
```
But it does work if I make the calculation myself.
g++ issued a warning (-Woverflow) and there was an overflow.
Expected result is 10'080'000'000 which fits in uint64_t, but got an
overflow instead.
Best regards,
unrde
unrde@jetable.fr.nf
*** Reporter, please consider answering these questions, where appropriate ***
* What led up to the situation?
* What exactly did you do (or not do) that was effective (or
ineffective)?
* What was the outcome of this action?
* What outcome did you expect instead?
*** End of the template - remove these template lines ***
-- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 4.7.0-1-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages g++-6 depends on:
ii gcc-6 6.2.0-13
ii gcc-6-base 6.2.0-13
ii libc6 2.24-7
ii libgmp10 2:6.1.1+dfsg-1
ii libisl15 0.17.1-1
ii libmpc3 1.0.3-1
ii libmpfr4 3.1.5-1
ii libstdc++-6-dev 6.2.0-13
ii zlib1g 1:1.2.8.dfsg-2+b3
g++-6 recommends no packages.
Versions of packages g++-6 suggests:
pn g++-6-multilib <none>
pn gcc-6-doc <none>
pn libstdc++6-6-dbg <none>
-- no debconf information
Reply to: