public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "acoplan at gcc dot gnu.org" <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, 23 Jun 2020 14:34:04 +0000 [thread overview] Message-ID: <bug-95676-4-fDdaZZ4ER8@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 Alex Coplan <acoplan at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |RESOLVED Resolution|--- |INVALID --- Comment #4 from Alex Coplan <acoplan at gcc dot gnu.org> --- Looks like the program has undefined behavior (signed integer overflow), so not a compiler bug. $ cat test.cc #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() ? 42 : 0; } $ g++ test.cc -fsanitize=undefined -I msgpack-c/include/ -I boost_1_73_0 $ ./a.out /usr/include/c++/7/chrono:176:38: runtime error: signed integer overflow: -9223372037 * 1000000000 cannot be represented in type 'long int' /usr/include/c++/7/chrono:379:8: runtime error: signed integer overflow: 9223372036709551616 + 145224192 cannot be represented in type 'long int' I get the same result with clang++ as well.
prev parent reply other threads:[~2020-06-23 14:34 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 2020-06-23 4:45 ` jamessan at jamessan dot com 2020-06-23 14:34 ` acoplan at gcc dot gnu.org [this message]
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-fDdaZZ4ER8@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).