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

            Bug ID: 119466
           Summary: Incorrect result generated by g++
           Product: gcc
           Version: 14.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zleyk at tamu dot edu
  Target Milestone: ---

Created attachment 60878
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60878&action=edit
A simple C++ code producing the buggy result when compiled by g++

Using g++ on my machine (and several others) 555 is produced instead of the
correct answer 559. The assembly shows that the address c points to (b's
address) is stored in a register, the function call is made, then the return
value of the function is stored at the address the register holds instead of
loading c's address again. Note that the clang-based compilers produce the
correct answer 559. Also, the code analysis (code tracing) indicates that 555
is incorrect.

Reply via email to