From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11278 invoked by alias); 1 Aug 2002 05:56:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 11251 invoked by uid 71); 1 Aug 2002 05:56:02 -0000 Resent-Date: 1 Aug 2002 05:56:02 -0000 Resent-Message-ID: <20020801055602.11250.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, hjwidmai@foxboro.com Received: (qmail 6954 invoked from network); 1 Aug 2002 05:46:39 -0000 Received: from unknown (HELO fox-nep27-xch.foxboro.com) (65.204.211.10) by sources.redhat.com with SMTP; 1 Aug 2002 05:46:39 -0000 Received: from sparc6.dev (SPARC6 [192.131.119.6]) by fox-nep27-xch.foxboro.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2655.55) id P08B4S3F; Thu, 1 Aug 2002 01:46:39 -0400 Received: from linux1 (linux1 [192.131.119.2]) by sparc6.dev (8.11.1/8.11.1) with ESMTP id g715kQp06918 for ; Thu, 1 Aug 2002 07:46:26 +0200 (MET DST) Received: (from hjwidmai@localhost) by linux1 (8.11.6/8.11.6/SuSE Linux 0.5) id g715i6o14828; Thu, 1 Aug 2002 07:44:06 +0200 Message-Id: <200208010544.g715i6o14828@linux1> Date: Wed, 31 Jul 2002 22:56:00 -0000 From: Hans-Joachim Widmaier Reply-To: hjwidmai@foxboro.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: target/7462: Bad code for unalign access on PPC X-SW-Source: 2002-07/txt/msg00829.txt.bz2 List-Id: >Number: 7462 >Category: target >Synopsis: Bad code for unalign access on PPC >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: pessimizes-code >Submitter-Id: net >Arrival-Date: Wed Jul 31 22:56:02 PDT 2002 >Closed-Date: >Last-Modified: >Originator: >Release: 3.1.1 >Organization: Foxboro Eckardt Development GmbH >Environment: System: Linux linux1 2.4.10-4GB #1 Tue Sep 25 12:33:54 GMT 2001 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: powerpc-unknown-rtems configured with: /pub/build/gcc-3.1.1/configure --host=i686-pc-linux-gnu --target=powerpc-rtems --disable-nls --disable-shared --enable-languages=c --with-newlib --with-cpu=405 --enable-threads=rtems >Description: Unaligned accesses to short/long/float variables in memory generate code which does multiple byte loads/stores with masking and shifting instead of 1 halfword/word load/store. On processors that do not support unaligned accesses this is the correct thing to do. For those that do, it is worse than just creating bad code: if the variable happens to live in a little-endian memory region it will not be swapped and therefore be invalid. >How-To-Repeat: The code was compiled with: powerpc-rtems-gcc -fallow-single-precision -mno-strict-align -fsingle-precision-constant -mcpu=405 -mtune=405 -O2 -c align.c # 1 "align.c" # 1 "" # 1 "" # 1 "align.c" #pragma pack(1) struct atest { char b; float f; long l; } ATest; # 26 "align.c" void bad(void) { ATest.f *= 6.5; ATest.l *= 6; } void ok(void) { *&ATest.f *= 6.5; *&ATest.l *= 6; } >Fix: The split-up into byte accesses is not done when the memory is accessed via a pointer as in function ok() above. >Release-Note: >Audit-Trail: >Unformatted: