From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40782 invoked by alias); 9 Jan 2017 11:14:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 40769 invoked by uid 89); 9 Jan 2017 11:14:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:2156, H*i:sk:2215080, H*f:sk:2215080 X-HELO: mail-ua0-f193.google.com Received: from mail-ua0-f193.google.com (HELO mail-ua0-f193.google.com) (209.85.217.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 09 Jan 2017 11:14:44 +0000 Received: by mail-ua0-f193.google.com with SMTP id d5so42063020uag.0 for ; Mon, 09 Jan 2017 03:14:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=TxxRk4rpfVHKqksEM9Tf1RxrzqYr+A9qPSLq1m4AATc=; b=ZUJKiSJ0mYn6ZN2r76kvTX8imBfu4YiIiZTvQDX/eAG4pPyxGuk+76TdzGDsbtd9Np lx7PdZYw2+MZG5whrLLxwfhX0j3wSmN0MqdS7urF0twaaXAkQn/YDkM3iAsBHRONZwgf oJVKeuGGl12+hTeGAP1NlSCq11F6mj3m1Mr1m789935xFjkpngE98FmGNqLpUPSxWOWY Qu8pwYJHb7H8qVXpMJoYxBioz5Bl63LkxNCtWbFmfhPggdIkJZc61bfPw4XQu/ihkwi6 k6ukNb3j+sYelplBDwn6Iov6d5MYXHweVBnN9fHrsPniqNjhFq1X5HEWhRk7wZRZRZLB wWHA== X-Gm-Message-State: AIkVDXLfEhZz2ZYJE0ZlJjm/JOq1jDUgYsFf4Y6bGQEgxi89rIBWzqWGhJBVMf/ywnQS6AT9pCld+SEXOgupfg== X-Received: by 10.176.5.69 with SMTP id 63mr53305589uax.71.1483960482761; Mon, 09 Jan 2017 03:14:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.72.8 with HTTP; Mon, 9 Jan 2017 03:14:42 -0800 (PST) In-Reply-To: <22150809.kPoQm0lI1j@polaris> References: <22150809.kPoQm0lI1j@polaris> From: Richard Biener Date: Mon, 09 Jan 2017 11:14:00 -0000 Message-ID: Subject: Re: [patch] Fix wrong code for return of small aggregates on big-endian To: Eric Botcazou Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00523.txt.bz2 On Mon, Jan 9, 2017 at 11:43 AM, Eric Botcazou wrote: > Hi, > > this is a regression present on all active branches for big-endian targets > returning small aggregate types in registers under certain circumstances and > when optimization is enabled: when the bitfield path of store_field is taken, > the function ends up calling store_bit_field to store the value. Now the > behavior of store_bit_field is awkward when the mode is BLKmode: it always > takes its value from the lsb up to the word size but expects it left justified > beyond it (see expmed.c:890 and below) and I missed that when I got rid of the > stack temporaries that were originally generated in that case. > > Of course that's OK for little-endian targets but not for big-endian targets, > and I have a couple of C++ testcases exposing the issue on SPARC 64-bit and a > couple of Ada testcases exposing the issue on PowerPC with the SVR4 ABI (the > Linux ABI is immune since it always returns on the stack); I think they cover > all the cases in the problematic code. > > The attached fix was tested on a bunch of platforms: x86/Linux, x86-64/Linux, > PowerPC/Linux, PowerPC64/Linux, PowerPC/VxWorks, Aarch64/Linux, SPARC/Solaris > and SPARC64/Solaris with no regressions. OK for the mainline? other branches? Ok for trunk and branches after a short burn-in. Thanks, Richard. > > 2017-01-09 Eric Botcazou > > * expr.c (store_field): In the bitfield case, if the value comes from > a function call and is of an aggregate type returned in registers, do > not modify the field mode; extract the value in all cases if the mode > is BLKmode and the size is not larger than a word. > > > 2017-01-09 Eric Botcazou > > * g++.dg/opt/call2.C: New test. > * g++.dg/opt/call3.C: Likewise. > * gnat.dg/array26.adb: New test. > * gnat.dg/array26_pkg.ad[sb]: New helper. > * gnat.dg/array27.adb: New test. > * gnat.dg/array27_pkg.ad[sb]: New helper. > * gnat.dg/array28.adb: New test. > * gnat.dg/array28_pkg.ad[sb]: New helper. > > -- > Eric Botcazou