https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95676
Bug ID: 95676
Summary: [armhf] g++ mis-compiles code at -O1 or above
Product: gcc
Version: 9.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jamessan at jamessan dot com
Target Milestone: ---
Created attachment 48730
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48730&action=edit
Reduced test case
After uploading msgpack-c 3.3.0 to Debian, the armhf build failed due to a
specific test failing. I originally reported this to msgpack-c's upstream:
https://github.com/msgpack/msgpack-c/issues/881
However, after testing on Debian's porterbox, it seems to be a GCC issue. The
issue does not reproduce when compiled with -O0 but does with -O1 or higher.
Similarly, changing the line that was failing from using googletest's
"EXPECT_TRUE(foo == bar);" to "EXPECT_EQ(foo, bar);" caused the test to pass.
I was able to use creduce to produce the attached file, test.cpp, which
exhibits the problem. The final assignment in main (cd = ce.aq<ba::z::bw>() ==
g;) should always evaluate to true.