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

            Bug ID: 90186
           Summary: optimizing options -O1 and -O2  produce different
                    results
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: austin.card at torchtechnologies dot com
  Target Milestone: ---

Created attachment 46209
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46209&action=edit
source code and input .txt file

CentOS 7:

g++ -std=c++11 -O1 -o CheckSum main.cpp CheckSum.cpp -I/usr/local/include
./CheckSum 

prints a different checksum result than

g++ -std=c++11 -O2 -o CheckSum main.cpp CheckSum.cpp -I/usr/local/include
./CheckSum

If you uncomment line 144 of Udp.h, then both builds output the same result.

Attached is the source code and an input .txt file.

Reply via email to