Public bug reported:

This bug report is a simplification of the following issue reported against 
CppAD:
https://github.com/coin-or/CppAD/issues/44

The attached file (to_string.sh) is a bash script that demonstrates the
problem.

In summary (of running to_string.sh) the following source code has a different 
result for ok
depending on if PRINT_BEFOR_CHECK is 0 or 1.

    int max        = std::numeric_limits<int>::max();
    os             << max;
    std::string s  = os.str();
    int check      = string2int(s);
# if PRINT_BEFORE_CHECK
    std::cout << "max = " << max << ", check = " << check << "\n";
# endif
    ok            &= max == check;

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: g++ 4:7.4.0-1ubuntu2.2
ProcVersionSignature: Ubuntu 4.15.0-51.55-generic 4.15.18
Uname: Linux 4.15.0-51-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.6
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sun Jun  9 07:58:29 2019
InstallationDate: Installed on 2018-10-24 (227 days ago)
InstallationMedia: Ubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725)
SourcePackage: gcc-defaults
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: gcc-defaults (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug bionic

** Attachment added: "to_string.sh"
   
https://bugs.launchpad.net/bugs/1832132/+attachment/5269747/+files/to_string.sh

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1832132

Title:
  incorrect results for g++ -std=c++11 -O3 -DNDEBUG

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1832132/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to