From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25567 invoked by alias); 17 Jul 2012 11:10:26 -0000 Received: (qmail 25554 invoked by uid 22791); 17 Jul 2012 11:10:25 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Jul 2012 11:10:11 +0000 From: "raul.baz at quest dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/53994] New: different result copying doubles(nan) Date: Tue, 17 Jul 2012 11:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: raul.baz at quest dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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: 2012-07/txt/msg01297.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53994 Bug #: 53994 Summary: different result copying doubles(nan) Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: raul.baz@quest.com Created attachment 27811 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27811 source code, just copy the numbers and does a memcmp over the results to check its value For the test I've used a structure with two unsigned char pointers. The structure has 64 bits of length and it could have any value (memory addresses). If I cast to double and copy the value of the structure to a new varable (double) if the contents of the structure is a nan the bit 51 is set to one. Attached a source file that copies two numbers: Number copied Expected Result result 0x7ff0000000000001 0x7ff0000000000001 0x7ff8000000000001 -- WRONG 0x7ff8000000000001 0x7ff8000000000001 0x7ff8000000000001 -- OK I know that these are nan and that probably they shouldn't be copied that way but what may me think it's worng is the fact that these was not happening under gcc 3.4.6. Thanks, Raul