From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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== Return-Path: 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 06:59:00 -0000 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-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-IsSubscribed: yes X-SW-Source: 2019-02/txt/msg00926.txt.bz2 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); -- Alan Modra Australia Development Lab, IBM