From patchwork Fri Jul 12 22:16:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriraman Tallam X-Patchwork-Id: 258814 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 880212C034F for ; Sat, 13 Jul 2013 08:16:48 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=ZVJ6DqOdFwER8SUDkiAFIR/mIux71TONJ3bL0xSHpCMJ8z Ho5AFVWLwaKOQbTOixPmBly1Fa69erFMD5qKrYsgbc66DL5SooY8JjiKVjAyVPRd pLGw7XYxVBPCDmlv7u18NVNPc/+gDzbIeFg+cEEGakZxNPFYzEmNxoSMDCGuU= 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 :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=nP76/cFwodqEQQ35Pk9yQDBNyIY=; b=j/I4nQV4xasqlAmLOqBy M16S+WjXVZd9o/kGI9NKG0YXjTFEPCRMW5h9MPAEVjUCrEuEkAoHIZkIiT4IA0K9 judTQBvnG/im2+C3hgYetXV6BdXJss/xxGQVbR6SzRgs5LI0gqT0RBpp4Ta8r0fN F7/kB1/sLg/T5D20W8HU5t4= Received: (qmail 24053 invoked by alias); 12 Jul 2013 22:16:42 -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 24042 invoked by uid 89); 12 Jul 2013 22:16:41 -0000 X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_YE, RDNS_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.1 Received: from Unknown (HELO mail-ee0-f47.google.com) (74.125.83.47) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 12 Jul 2013 22:16:40 +0000 Received: by mail-ee0-f47.google.com with SMTP id e49so6408176eek.20 for ; Fri, 12 Jul 2013 15:16:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :x-gm-message-state; bh=Swm9jWh0upTW2X8eOfrrZVW+5raGTDvyCZUBPO1DcpA=; b=fgg5TFkXEXZbUJs9tM3KNuhA6zWT5FEb/yDjexfp5uGWf7IDtkKP0gICHRfikPqREr xAA5HPxvY65YwxP6GHT0ImsKWI0dWHtd74cCeW+FjbiIu/pdL24b7hRB5iupEJc43e7p fjdgt5k87ZcaZjt5yfHwttLOjWoQBrTn+klan0zqNnZF7J/KK6AuZPdAf9lU7Ug1kKTn T0ufnHjr6WrBEw9c4nvwRcGEUIQyogJCe6aZXkABrrexjaSVa2YsAwK5bDHEOErvIMGK NaV2gRDgdvoes99yYQP8cliM0DFfnRFy20Kwf/88eFOcbxUDTNjifEwCTh5eQGiq0liJ K05w== MIME-Version: 1.0 X-Received: by 10.15.41.71 with SMTP id r47mr48699915eev.63.1373667391790; Fri, 12 Jul 2013 15:16:31 -0700 (PDT) Received: by 10.14.141.145 with HTTP; Fri, 12 Jul 2013 15:16:31 -0700 (PDT) Date: Fri, 12 Jul 2013 15:16:31 -0700 Message-ID: Subject: [PATCH] Fix for PR57698 From: Sriraman Tallam To: GCC Patches , Jan Hubicka , kpet@free.fr, marcus.shawcroft@arm.com, =?UTF-8?Q?Martin_Li=C5=A1ka?= , David Li , dimhen@gmail.com X-Gm-Message-State: ALoCoQnFBZRRb6wxPCHu0LGhqIkjCSu3H5mtEgtmiaRnpJ7BX5yxuKKaztFUig7ybvZe13bQ+dtYzY8ekPVeTrD3JRABoG1r9qWcE653AkS6yXaSvMHbmX+MH+udBOnOGgieiusT7TtEqPvqA/GNUWfJwnRmyDj5pYhgHFaDW4dDbw6nYQjcI29mFnYNlR12WXLDYwGgGS5gLVgV6SFFFSXlSo6VB2SHTw== X-Virus-Found: No X-IsSubscribed: yes Patch attached to fix this: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57698 Here is what is going on. In rev. 200179, this change to tree-inline.c Seems like the right fix to me. Ok? The whole patch with test case included is attached. Thanks Sri * tree-inline.c (expand_call_inline): Emit errors during early_inlining only if optimization is not turned on. * gcc.c-torture/compile/pr57698.c: New test. * gcc.c-torture/compile/pr43791.c: Remove prune output directive. * gcc.c-torture/compile/pr44043.c: Ditto. Index: testsuite/gcc.c-torture/compile/pr57698.c =================================================================== --- testsuite/gcc.c-torture/compile/pr57698.c (revision 0) +++ testsuite/gcc.c-torture/compile/pr57698.c (revision 0) @@ -0,0 +1,19 @@ +typedef int (*IsAcceptableThis) (const int ); +inline int +fn1 (IsAcceptableThis p1) +{ + p1 (0); + return 0; +} + +__attribute__ ((always_inline)) +inline int fn2 (const int a) +{ + return 0; +} + +void +fn3 () +{ + fn1 (fn2); +} Index: testsuite/gcc.c-torture/compile/pr44043.c =================================================================== --- testsuite/gcc.c-torture/compile/pr44043.c (revision 200912) +++ testsuite/gcc.c-torture/compile/pr44043.c (working copy) @@ -85,5 +85,3 @@ int raw_sendmsg(struct sock *sk, struct msghdr *ms { raw_send_hdrinc(sk, msg->msg_iov, len, (void *)0, msg->msg_flags); } - -/* { dg-prune-output "(inlining failed in call to always_inline.*indirect function call with a yet undetermined callee|called from here)" } */ Index: testsuite/gcc.c-torture/compile/pr43791.c =================================================================== --- testsuite/gcc.c-torture/compile/pr43791.c (revision 200912) +++ testsuite/gcc.c-torture/compile/pr43791.c (working copy) @@ -18,5 +18,3 @@ void fasttrylock(void (*slowfn)()) { void trylock(void) { fasttrylock(slowtrylock); } - -/* { dg-prune-output "(inlining failed in call to always_inline.*indirect function call with a yet undetermined callee|called from here)" } */ Index: tree-inline.c =================================================================== --- tree-inline.c (revision 200912) +++ tree-inline.c (working copy) @@ -3905,6 +3905,10 @@ expand_call_inline (basic_block bb, gimple stmt, c for inlining, but we can't do that because frontends overwrite the body. */ && !cg_edge->callee->local.redefined_extern_inline + /* During early inline pass, report only when optimization is + not turned on. */ + && (cgraph_global_info_ready + || !optimize) /* PR 20090218-1_0.c. Body can be provided by another module. */ && (reason != CIF_BODY_NOT_AVAILABLE || !flag_generate_lto)) { Index: tree-inline.c =================================================================== --- tree-inline.c (revision 200178) +++ tree-inline.c (revision 200179) @@ -3905,8 +3905,6 @@ for inlining, but we can't do that because frontends overwrite the body. */ && !cg_edge->callee->local.redefined_extern_inline - /* Avoid warnings during early inline pass. */ - && cgraph_global_info_ready /* PR 20090218-1_0.c. Body can be provided by another module. */ && (reason != CIF_BODY_NOT_AVAILABLE || !flag_generate_lto)) { made inline failure errors during early inlining reportable. Now, this function is called when the early_inliner calls optimize_inline_calls. The reason for the failure, CIF_INDIRECT_UNKNOWN_CALL, should not be reported because it is not a valid reason,(see can_inline_edge_p in ipa-inline.c for the list of reasons we intend to report) but it gets reported because of the above change. The reported bug happens only when optimization is turned on as the early inliner pass invokes incremental inlining which calls optimize_inline_calls and triggers the above failure. So, the fix is then as simple as: Index: tree-inline.c =================================================================== --- tree-inline.c (revision 200912) +++ tree-inline.c (working copy) @@ -3905,6 +3905,10 @@ expand_call_inline (basic_block bb, gimple stmt, c for inlining, but we can't do that because frontends overwrite the body. */ && !cg_edge->callee->local.redefined_extern_inline + /* During early inline pass, report only when optimization is + not turned on. */ + && (cgraph_global_info_ready + || !optimize) /* PR 20090218-1_0.c. Body can be provided by another module. */ && (reason != CIF_BODY_NOT_AVAILABLE || !flag_generate_lto)) {