Created attachment 1355685 [details] code to reproduce this bug with C++ Description of problem: gdb reports the wrong contents of a variable, while printing the content of the variable to stdout provides good results Version-Release number of selected component (if applicable): 8.0.1-30.fc26 How reproducible: Compile this code ``` $ cat test.cpp #include <iostream> int main(int argc, char** argv){ double rvalue = 0.3; std::cout << "- " << rvalue << "\n"; double a,b; rvalue = 0.3; std::cout << ": " << rvalue << "\n"; return rvalue < 1. ? 0 : 1; } ``` with gcc/g++ and run it inside gdb. the contents of rvalue are printed to the screen in a bogus fashion. Only after the second assignment of "rvalue", gdb prints the correct result. Motivates wrong conclusions in practice. Steps to Reproduce: 1. g++ -mavx -g test.cpp 2. gdb ./a.out 3. (gdb) b test.cpp:5 4. (gdb) rrun 5. (gdb) next 6. (gdb) p rvalue $1 = 7.0607433379231282e-184 Actual results: $1 = 7.0607433379231282e-184 Expected results: $1 = 0.29999999 Additional info: - the example above is a contrived example that reproduces the behavior found with a real development project - Also found this behavior on fc25 with 7.12.1-48.fc25 before upgrading - Also observed this on Ubuntu 16.04.3 with 7.11.1-0ubuntu1~16.5 - running the code, prints the right results to stdout - the behavior can be reproduced with C
Tracked upstream: https://sourceware.org/bugzilla/show_bug.cgi?id=22499
gdb-8.0.1-32.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-ffd35436cf
gdb-8.0.1-32.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-0bf0f4ba91
gdb-8.0.1-33.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-7328f5705a
gdb-8.0.1-33.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-5139b2c38c
gdb-8.0.1-33.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-5139b2c38c
gdb-8.0.1-33.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-7328f5705a
gdb-8.0.1-33.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.
gdb-8.0.1-33.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.