public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/97004] [nvptx] __int128 initializer incorrect Date: Thu, 10 Sep 2020 13:24:00 +0000 [thread overview] Message-ID: <bug-97004-4-Q8pTOXFmPb@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-97004-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97004 --- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> --- Tentative patch: ... diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c index 0376ad6ce9f..26868590322 100644 --- a/gcc/config/nvptx/nvptx.c +++ b/gcc/config/nvptx/nvptx.c @@ -2054,7 +2054,11 @@ nvptx_assemble_value (unsigned HOST_WIDE_INT val, unsigned size) for (unsigned part = 0; size; size -= part) { - val >>= part * BITS_PER_UNIT; + if (part == sizeof (val)) + /* Avoid undefined behaviour. */ + val = 0; + else + val >>= (part * BITS_PER_UNIT); part = init_frag.size - init_frag.offset; part = MIN (part, size); ... And we have: ... // BEGIN GLOBAL VAR DEF: g .visible .global .align 8 .u64 g[2] = { 9, 0 }; ...
next prev parent reply other threads:[~2020-09-10 13:24 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-09 22:39 [Bug target/97004] New: " vries at gcc dot gnu.org 2020-09-10 13:24 ` vries at gcc dot gnu.org [this message] 2020-09-10 13:34 ` [Bug target/97004] " jakub at gcc dot gnu.org 2020-09-10 19:30 ` cvs-commit at gcc dot gnu.org 2020-09-10 19:33 ` vries 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-97004-4-Q8pTOXFmPb@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).