From patchwork Wed Feb 13 06:59:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 1040979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-495983-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="c/iVKDm4"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="g1ismZ23"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43zr3v1jBPz9s5c for ; Wed, 13 Feb 2019 17:59:19 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=Xgs7nMeveyaBR7TNjtHR8orNdxoCUNMvgn72g+VrGL9IknuMU3 0gH89GKPUOY1Ov+Uo575zTVoTBkrZaHUjkje/B3tw40PriWzO2pLuJLyGobVvDde SLrM5/BEuUn5/fawS7qGtEcmd+iZixHv4u28pbgbsboX7+5ie9xJbPEY4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=LScnbeMVA71em3RH796v9dcWPWo=; b=c/iVKDm4CmwK6yIWy7ij 4isln/KWdBjUxN45RXjAwj9sIGPUDAA/2VUiLWDjX8dN7GeE5A0cVMaMSBwCDJnE 7ms3WNrE+NX3Gluv7hbdfcgTcmt62zzazEir4NxFBWJk4yro7bZuCk+fQKYbjc0G CSO9dc8cSVHynEB83i25gbY= Received: (qmail 115886 invoked by alias); 13 Feb 2019 06:59:09 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 115840 invoked by uid 89); 13 Feb 2019 06:59:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1251, waste X-HELO: mail-pf1-f174.google.com Received: from mail-pf1-f174.google.com (HELO mail-pf1-f174.google.com) (209.85.210.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Feb 2019 06:59:07 +0000 Received: by mail-pf1-f174.google.com with SMTP id b7so723188pfi.8 for ; Tue, 12 Feb 2019 22:59:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=Dk0uWqQ0yUezyHo5lT8P7DhCNIalf/lxSBxwGtoA27I=; b=g1ismZ23Hd4sGzm7H0k6Oin7vwclUQQlMQhgi7ovim+Gp+QS/hbYqufncLyePzrHYA s6jhpV5enrzjzLqDh6xjEk9qZePcEi26m3ALvGTRtixLqe6PZ694AU88E3Pyfdu95Adb QONMtZyA7BGX9XAiQddUDLNAWjw4jIQMPKNr/t1k0naeJEt2opq8dGbfNz1mLXR6TeO0 Tbwz0+kw+br6gcsVYUKEg+O/7VZij4Aa0TVfO5QFjAqpri0r3C4tF7zFR+U4+E+kCiYq 0xQhpVG+XAvMBo79ypuiTNUh0Ytxs1Ki+zN3qEcBbQ8nQ1ul88Bwi0OTTTFTy7XrKvGt 4C9g== Received: from bubble.grove.modra.org ([58.175.241.133]) by smtp.gmail.com with ESMTPSA id n73sm22428995pfj.148.2019.02.12.22.59.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Feb 2019 22:59:04 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id B36B2807FD; Wed, 13 Feb 2019 17:29:01 +1030 (ACDT) Date: Wed, 13 Feb 2019 17:29:01 +1030 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: Segher Boessenkool Subject: PR87689, PowerPC64 ELFv2 function parameter passing violation Message-ID: <20190213065901.GB32753@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-IsSubscribed: yes Covers for a generic fortran bug. The effect is that we'll needlessly waste 64 bytes of stack space on some calls, but I don't see any simple and fully correct patch in generic code. Bootstrapped and regression tested powerpc64le-linux. OK mainline and branches? PR target/87689 * config/rs6000/rs6000.c (rs6000_function_parms_need_stack): Cope with fortran function decls that lack all args. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 31256a4da8d..288b7606b5e 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -12325,6 +12325,13 @@ rs6000_function_parms_need_stack (tree fun, bool incoming) if ((!incoming && !prototype_p (fntype)) || stdarg_p (fntype)) return true; + /* FIXME: Fortran arg lists can contain hidden parms, fooling + prototype_p into saying the function is prototyped when in fact + the number and type of args is unknown. See PR 87689. */ + if (!incoming && (strcmp (lang_hooks.name, "GNU F77") == 0 + || lang_GNU_Fortran ())) + return true; + INIT_CUMULATIVE_INCOMING_ARGS (args_so_far_v, fntype, NULL_RTX); args_so_far = pack_cumulative_args (&args_so_far_v);