public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/40757] gcc 4.4.0 miscompiles mpfr-2.4.1 Date: Fri, 17 Jul 2009 07:49:00 -0000 [thread overview] Message-ID: <20090717074922.9560.qmail@sourceware.org> (raw) In-Reply-To: <bug-40757-16207@http.gcc.gnu.org/bugzilla/> ------- Comment #17 from jakub at gcc dot gnu dot org 2009-07-17 07:49 ------- Try: typedef __SIZE_TYPE__ size_t; extern void *memset (void *, const void *, size_t); extern void abort (void); volatile size_t i = 0x80000000U, j = 0x80000000U; char buf[16]; int main (void) { if (sizeof (size_t) != 4) return 0; buf[0] = 6; memset (buf, 0, i + j); if (buf[0] != 6) abort (); return 0; } In 32-bit code, size_t is 32-bit, memset is called with buf, 0, 0 arguments, but the %o2 register passed to it doesn't contain 0, but 0x100000000. That is fine, this is 32-bit code, so the uppermost bits are always undefined. But when 32-bit memset uses brnz %o2, ... instruction, it needs to first zero-extend it to 64-bits, as brnz operates on all 64 bits only. Or not use brnz, but compare and be %icc, ... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40757
next prev parent reply other threads:[~2009-07-17 7:49 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-07-15 0:36 [Bug c/40757] New: " zimmerma+gcc at loria dot fr 2009-07-15 2:02 ` [Bug c/40757] " zimmerma+gcc at loria dot fr 2009-07-15 6:27 ` ebotcazou at gcc dot gnu dot org 2009-07-15 9:55 ` rguenth at gcc dot gnu dot org 2009-07-15 13:15 ` mikpe at it dot uu dot se 2009-07-16 7:52 ` zimmerma+gcc at loria dot fr 2009-07-16 8:31 ` mikpe at it dot uu dot se 2009-07-16 10:19 ` david dot kirkby at onetel dot net 2009-07-16 10:24 ` david dot kirkby at onetel dot net 2009-07-16 10:31 ` jakub at gcc dot gnu dot org 2009-07-16 12:32 ` david dot kirkby at onetel dot net 2009-07-16 14:07 ` jakub at gcc dot gnu dot org 2009-07-16 20:34 ` marc dot glisse at normalesup dot org 2009-07-16 21:29 ` david dot kirkby at onetel dot net 2009-07-17 0:58 ` zimmerma+gcc at loria dot fr 2009-07-17 3:22 ` david dot kirkby at onetel dot net 2009-07-17 4:11 ` david dot kirkby at onetel dot net 2009-07-17 7:49 ` jakub at gcc dot gnu dot org [this message] 2009-07-17 11:19 ` david dot kirkby at onetel dot net 2009-07-17 15:51 ` marc dot glisse at normalesup dot org 2009-07-18 1:14 ` david dot kirkby at onetel dot net 2009-07-18 1:18 ` david dot kirkby at onetel dot net 2009-07-18 4:50 ` marc dot glisse at normalesup dot org 2009-07-18 14:36 ` david dot kirkby at onetel dot net 2009-07-18 14:44 ` david dot kirkby at onetel dot net 2009-07-18 19:33 ` david dot kirkby at onetel dot net 2009-10-01 8:34 ` [Bug target/40757] " david dot kirkby at onetel dot net 2009-10-04 11:01 ` ebotcazou at gcc dot gnu dot 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=20090717074922.9560.qmail@sourceware.org \ --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).