From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5479 invoked by alias); 1 Feb 2010 18:51:14 -0000 Received: (qmail 5469 invoked by uid 22791); 1 Feb 2010 18:51:13 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail-out.m-online.net (HELO mail-out.m-online.net) (212.18.0.9) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 01 Feb 2010 18:51:08 +0000 Received: from mail01.m-online.net (mail.m-online.net [192.168.3.149]) by mail-out.m-online.net (Postfix) with ESMTP id 519CB1C156F4 for ; Mon, 1 Feb 2010 19:51:06 +0100 (CET) Received: from localhost (dynscan2.mnet-online.de [192.168.6.166]) by mail.m-online.net (Postfix) with ESMTP id 26288901EA for ; Mon, 1 Feb 2010 19:51:06 +0100 (CET) Received: from mail.mnet-online.de ([192.168.3.149]) by localhost (dynscan2.mnet-online.de [192.168.6.166]) (amavisd-new, port 10024) with ESMTP id 05N4aMHt319q for ; Mon, 1 Feb 2010 19:51:04 +0100 (CET) Received: from igel.home (DSL01.83.171.152.151.ip-pool.NEFkom.net [83.171.152.151]) by mail.mnet-online.de (Postfix) with ESMTP for ; Mon, 1 Feb 2010 19:51:04 +0100 (CET) Received: by igel.home (Postfix, from userid 501) id AC371CA297; Mon, 1 Feb 2010 19:51:04 +0100 (CET) From: Andreas Schwab To: gdb-patches@sourceware.org Subject: sim/ppc: fix aliasing bugs X-Yow: LBJ, LBJ, how many JOKES did you tell today??! Date: Mon, 01 Feb 2010 18:51:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-02/txt/msg00022.txt.bz2 invalid_arithemetic_operation expects a unsigned64*, but was passed a double* or even float*. Andreas. 2010-02-01 Andreas Schwab * ppc-instructions: Fix aliasing bugs when calling invalid_arithemetic_operation. Index: sim/ppc/ppc-instructions =================================================================== RCS file: /cvs/src/src/sim/ppc/ppc-instructions,v retrieving revision 1.11 diff -u -a -p -r1.11 sim/ppc/ppc-instructions --- sim/ppc/ppc-instructions 12 Jan 2009 20:04:36 -0000 1.11 +++ sim/ppc/ppc-instructions 1 Feb 2010 18:41:58 -0000 @@ -3973,12 +3973,14 @@ void::function::invalid_zero_divide_oper fpscr_vxsnan | fpscr_vximz, 0, /*single?*/ 0) /*negate?*/) { + union { double d; unsigned64 u; } tmp; invalid_arithemetic_operation(processor, cia, - (unsigned64*)&product, *frA, 0, *frC, + &tmp.u, *frA, 0, *frC, 0, /*instruction_is_frsp*/ 0, /*instruction_is_convert_to_64bit*/ 0, /*instruction_is_convert_to_32bit*/ 0); /*single-precision*/ + product = tmp.d; } else { /*HACK!*/ @@ -4018,12 +4020,14 @@ void::function::invalid_zero_divide_oper fpscr_vxsnan | fpscr_vximz, 1, /*single?*/ 0) /*negate?*/) { + union { double d; unsigned64 u; } tmp; invalid_arithemetic_operation(processor, cia, - (unsigned64*)&product, *frA, 0, *frC, + &tmp.u, *frA, 0, *frC, 0, /*instruction_is_frsp*/ 0, /*instruction_is_convert_to_64bit*/ 0, /*instruction_is_convert_to_32bit*/ 0); /*single-precision*/ + product = tmp.d; } else { /*HACK!*/ @@ -4063,12 +4067,14 @@ void::function::invalid_zero_divide_oper fpscr_vxsnan | fpscr_vximz, 0, /*single?*/ 0) /*negate?*/) { + union { double d; unsigned64 u; } tmp; invalid_arithemetic_operation(processor, cia, - (unsigned64*)&product, *frA, 0, *frC, + &tmp.u, *frA, 0, *frC, 0, /*instruction_is_frsp*/ 0, /*instruction_is_convert_to_64bit*/ 0, /*instruction_is_convert_to_32bit*/ 0); /*single-precision*/ + product = tmp.d; } else { /*HACK!*/ @@ -4108,12 +4114,14 @@ void::function::invalid_zero_divide_oper fpscr_vxsnan | fpscr_vximz, 1, /*single?*/ 0) /*negate?*/) { + union { double d; unsigned64 u; } tmp; invalid_arithemetic_operation(processor, cia, - (unsigned64*)&product, *frA, 0, *frC, + &tmp.u, *frA, 0, *frC, 0, /*instruction_is_frsp*/ 0, /*instruction_is_convert_to_64bit*/ 0, /*instruction_is_convert_to_32bit*/ 0); /*single-precision*/ + product = tmp.d; } else { /*HACK!*/ @@ -4153,8 +4161,9 @@ void::function::invalid_zero_divide_oper fpscr_vxsnan | fpscr_vximz, 0, /*single?*/ 0) /*negate?*/) { + union { double d; unsigned64 u; } tmp; invalid_arithemetic_operation(processor, cia, - (unsigned64*)&product, *frA, 0, *frC, + &tmp.u, *frA, 0, *frC, 0, /*instruction_is_frsp*/ 0, /*instruction_is_convert_to_64bit*/ 0, /*instruction_is_convert_to_32bit*/ @@ -4198,12 +4207,14 @@ void::function::invalid_zero_divide_oper fpscr_vxsnan | fpscr_vximz, 1, /*single?*/ 0) /*negate?*/) { + union { double d; unsigned64 u; } tmp; invalid_arithemetic_operation(processor, cia, - (unsigned64*)&product, *frA, 0, *frC, + &tmp.u, *frA, 0, *frC, 0, /*instruction_is_frsp*/ 0, /*instruction_is_convert_to_64bit*/ 0, /*instruction_is_convert_to_32bit*/ 0); /*single-precision*/ + product = tmp.d; } else { /*HACK!*/ @@ -4243,12 +4254,14 @@ void::function::invalid_zero_divide_oper fpscr_vxsnan | fpscr_vximz, 0, /*single?*/ 0) /*negate?*/) { + union { double d; unsigned64 u; } tmp; invalid_arithemetic_operation(processor, cia, - (unsigned64*)&product, *frA, 0, *frC, + &tmp.u, *frA, 0, *frC, 0, /*instruction_is_frsp*/ 0, /*instruction_is_convert_to_64bit*/ 0, /*instruction_is_convert_to_32bit*/ 0); /*single-precision*/ + product = tmp.d; } else { /*HACK!*/ @@ -4288,12 +4301,14 @@ void::function::invalid_zero_divide_oper fpscr_vxsnan | fpscr_vximz, 1, /*single?*/ 0) /*negate?*/) { + union { double d; unsigned64 u; } tmp; invalid_arithemetic_operation(processor, cia, - (unsigned64*)&product, *frA, 0, *frC, + &tmp.u, *frA, 0, *frC, 0, /*instruction_is_frsp*/ 0, /*instruction_is_convert_to_64bit*/ 0, /*instruction_is_convert_to_32bit*/ 0); /*single-precision*/ + product = tmp.d; } else { /*HACK!*/ -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."