public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "david dot kirkby at onetel dot net" <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 11:19:00 -0000 [thread overview]
Message-ID: <20090717111914.29718.qmail@sourceware.org> (raw)
In-Reply-To: <bug-40757-16207@http.gcc.gnu.org/bugzilla/>
------- Comment #18 from david dot kirkby at onetel dot net 2009-07-17 11:19 -------
(In reply to comment #17)
> 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, ...
>
I've compiled and linked that code. It does not abort. i.e. I do NOT see:
Abort (core dumped).
In 64-bit mode, it issues a warning:
$ gcc -m64 check.c
check.c:2: warning: conflicting types for built-in function 'memset'
but again builds an executable which exits normally.
If you want the assembler output posted from Tim's preprocessed file, let me
know how to do it and I'll do it, just in case gcc is behaving differently on
this machine to yours.
As I say, if you want an account Jakub, you can have one. Just tell me a user
name. It might be the simplest way for you to look at this.
Dave
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40757
next prev parent reply other threads:[~2009-07-17 11:19 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
2009-07-17 11:19 ` david dot kirkby at onetel dot net [this message]
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=20090717111914.29718.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: link
Be 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).