From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29782 invoked by alias); 17 Jul 2009 11:19:27 -0000 Received: (qmail 29719 invoked by uid 48); 17 Jul 2009 11:19:14 -0000 Date: Fri, 17 Jul 2009 11:19:00 -0000 Message-ID: <20090717111914.29718.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/40757] gcc 4.4.0 miscompiles mpfr-2.4.1 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "david dot kirkby at onetel dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-07/txt/msg01427.txt.bz2 ------- 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