NetBSD Problem Report #46865

From msaitoh@five.execsw.org  Mon Aug 27 09:24:23 2012
Return-Path: <msaitoh@five.execsw.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 39C0463B8E6
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 27 Aug 2012 09:24:23 +0000 (UTC)
Message-Id: <20120827092419.67ADB17E213A@five.execsw.org>
Date: Mon, 27 Aug 2012 18:24:19 +0900 (JST)
From: msaitoh@execsw.org
Reply-To: msaitoh@execsw.org
To: gnats-bugs@gnats.NetBSD.org
Subject: built-in memcpy() unaligned problem on the strict-align CPU
X-Send-Pr-Version: 3.95

>Number:         46865
>Category:       toolchain
>Synopsis:       built-in memcpy() unaligned problem on the strict-align CPU
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    martin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 27 09:25:00 +0000 2012
>Closed-Date:    Tue Sep 04 08:06:05 +0000 2012
>Last-Modified:  Tue Sep 04 08:06:05 +0000 2012
>Originator:     SAITOH Masanobu
>Release:        NetBSD 6.99.10
>Organization:
-----------------------------------------------
		SAITOH Masanobu (msaitoh@netbsd.org)
>Environment:
	netbsd-6 and -current that use gcc 4.5
Architecture: arm
Machine: evbarm
>Description:
	gcc 4.5.x has a bug that the optimizer makes unaligned builtin
	memcpy() code even if the target CPU is the strict-aligned CPU.

	see:
	http://mail-index.netbsd.org/current-users/2012/08/20/msg020951.html

	I got this problem on evbarm machines (both -current and netbsd-6).
	Other CPU may have the same problem(e.g. sparc).

>How-To-Repeat:
	Use test program that reported in:

	http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46483

>Fix:
	Make a patch or use gcc 4.6 or 4.7.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: toolchain-manager->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Mon, 27 Aug 2012 10:10:04 +0000
Responsible-Changed-Why:
take


From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/46865: built-in memcpy() unaligned problem on the strict-align CPU
Date: Fri, 31 Aug 2012 00:17:55 +0200

 --bg08WKrSYDhXBjb5
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 I think the analyzis in the bugzilla ticket is incomplete.

 The only change I could come up that fixes it for me on sparc64 is a
 very big hammer effectively disabling most of the builtin_*
 optimizations for STRICT_ALIGNMENT architectures.

 All better solutions welcome (assuming we can't switch to gcc 4.7 for
 netbsd-6 [HI RIZ!]).

 Martin

 --bg08WKrSYDhXBjb5
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="builtins.c.patch"

 Index: builtins.c
 ===================================================================
 RCS file: /cvsroot/src/external/gpl3/gcc/dist/gcc/builtins.c,v
 retrieving revision 1.1.1.1
 diff -c -u -r1.1.1.1 builtins.c
 --- builtins.c	21 Jun 2011 01:20:19 -0000	1.1.1.1
 +++ builtins.c	30 Aug 2012 22:07:57 -0000
 @@ -347,7 +347,7 @@
  can_trust_pointer_alignment (void)
  {
    /* We rely on TER to compute accurate alignment information.  */
 -  return (optimize && flag_tree_ter);
 +  return (!STRICT_ALIGNMENT && optimize && flag_tree_ter);
  }

  /* Return the alignment in bits of EXP, a pointer valued expression.

 --bg08WKrSYDhXBjb5--

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46865 CVS commit: src/external/gpl3/gcc/dist/gcc
Date: Sun, 2 Sep 2012 20:58:44 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun Sep  2 20:58:44 UTC 2012

 Modified Files:
 	src/external/gpl3/gcc/dist/gcc: builtins.c

 Log Message:
 Make can_trust_pointer_alignment() always return false on STRICT_ALIGNMENT
 archs - gcc 4.5 is not able to properly track alignment and backporting
 the fix from 4.6/4.7 is not feasible (according to upstream).
 See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46483 for details.
 Fixes PR toolchain/46865.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gcc/dist/gcc/builtins.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->pending-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 03 Sep 2012 16:45:59 +0000
State-Changed-Why:
fixed, pullup-6 #540


From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/46865 CVS commit: [netbsd-6] src/external/gpl3/gcc/dist/gcc
Date: Mon, 3 Sep 2012 19:24:27 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Mon Sep  3 19:24:27 UTC 2012

 Modified Files:
 	src/external/gpl3/gcc/dist/gcc [netbsd-6]: builtins.c

 Log Message:
 Pull up following revision(s) (requested by martin in ticket #540):
 	external/gpl3/gcc/dist/gcc/builtins.c: revision 1.2
 Make can_trust_pointer_alignment() always return false on STRICT_ALIGNMENT
 archs - gcc 4.5 is not able to properly track alignment and backporting
 the fix from 4.6/4.7 is not feasible (according to upstream).
 See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46483 for details.
 Fixes PR toolchain/46865.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1.1.1 -r1.1.1.1.4.1 \
     src/external/gpl3/gcc/dist/gcc/builtins.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 04 Sep 2012 08:06:05 +0000
State-Changed-Why:
pullup done, thanks all


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.