public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jamessan at jamessan dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/95676] [armhf] g++ mis-compiles code at -O1 or above Date: Tue, 16 Jun 2020 00:49:33 +0000 [thread overview] Message-ID: <bug-95676-4-hkeaNeGOgA@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-95676-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95676 --- Comment #2 from James McCoy <jamessan at jamessan dot com> --- Apologies for leaving off the build/configure information. I shouldn't have assumed one would have access to Debian's compiler. --8<-- abel% g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/9/lto-wrapper Target: arm-linux-gnueabihf Configured with: ../src/configure -v --with-pkgversion='Debian 9.3.0-13' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf --with-build-config=bootstrap-lto-lean --enable-link-mutex Thread model: posix gcc version 9.3.0 (Debian 9.3.0-13) -->8-- The original issue was this test code (which uses googletest) from msgpack-c unexpectedly failing with compiled with "g++ -std=c++11 -O1" but working with "g++ -std=c++11 -O0": --8<-- TEST(object_with_zone, system_clock_impl_min) { std::chrono::system_clock::time_point v(std::chrono::system_clock::time_point::min()); msgpack::zone z; msgpack::object obj(v, z); EXPECT_TRUE(obj.as<std::chrono::system_clock::time_point>() == v); } -->8-- The test is verifying that the min value can round-trip through msgpack::object Changing EXPECT_TRUE(... == v) to EXPECT_EQ(..., v) makes the code work with -O1, as does storing obj.as<...>() into a temporary (e.g., v2) and using that in the EXPECT_TRUE(v2 == v). Removing googletest from the picture was successful, so the example could be reduced to: --8<-- #include <msgpack.hpp> bool check_equality() { std::chrono::system_clock::time_point v(std::chrono::system_clock::time_point::min()); msgpack::zone z; msgpack::object obj(v, z); return obj.as<std::chrono::system_clock::time_point>() == v; } int main() { return check_equality(); } -->8-- This is what I then had creduce work with. The test script simply compiled the file twice, once with "g++ -std=c++11 -O0" and once with "g++ -std=c++11 -O1", verifying that the resulting binaries had an exit code of non-zero and zero, respectively. The bug reporting guidelines state to provide minimized test cases, so that's what I did. If there's more information, I'm happy to provide it. I'm not a compiler developer, so I'm not sure what information is needed.
next prev parent reply other threads:[~2020-06-16 0:49 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-15 4:33 [Bug c++/95676] New: " jamessan at jamessan dot com 2020-06-15 13:00 ` [Bug target/95676] " rearnsha at gcc dot gnu.org 2020-06-16 0:49 ` jamessan at jamessan dot com [this message] 2020-06-23 4:45 ` jamessan at jamessan dot com 2020-06-23 14:34 ` acoplan at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-95676-4-hkeaNeGOgA@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).