From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13358 invoked by alias); 7 Mar 2018 17:02:40 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 13091 invoked by uid 89); 7 Mar 2018 17:02:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=reserved X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Mar 2018 17:02:38 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A15BB28DE; Wed, 7 Mar 2018 17:02:37 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-22.rdu2.redhat.com [10.10.112.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id E46B25D756; Wed, 7 Mar 2018 17:02:36 +0000 (UTC) Subject: Re: BLKmode parameters are stored in unaligned stack slot when passed via registers. To: Renlin Li , "gcc@gcc.gnu.org" References: <2f9b6580-4c7d-d29d-157c-24fe6dd8f781@arm.com> From: Jeff Law Message-ID: Date: Wed, 07 Mar 2018 17:02:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <2f9b6580-4c7d-d29d-157c-24fe6dd8f781@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-03/txt/msg00100.txt.bz2 On 03/06/2018 08:21 AM, Renlin Li wrote: > Hi all, > > The problem described here probably only affects targets whose ABI allow > to pass structured > arguments of certain size via registers. > > If the mode of the parameter type is BLKmode, in the callee, during RTL > expanding, > a stack slot will be reserved for this parameter, and the incoming value > will be copied into > the stack slot. > > However, the stack slot for the parameter will not be aligned if the > alignment of parameter type > exceeds MAX_SUPPORTED_STACK_ALIGNMENT. > Chances are, unaligned memory access might cause run-time errors. My recollection here (the PA has a ABI which mandates this kind of stuff) is that you have to copy the object out of the potentially unaligned location into a suitably aligned local. The copy should be occurring in an alignment safe way. It also has to handle structures that are partially in registers, partially in memory and structures which are justified in the wrong direction. We never tried to optimize this stuff. It was rare enough to not worry about. jeff