public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bradley Lucier <lucier@purdue.edu>
To: David Malcolm <dmalcolm@redhat.com>,
	Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Cc: lucier@purdue.edu, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Add -Wdisabled-optimization warning for not optimizing sibling calls
Date: Sun, 6 Aug 2023 14:29:53 -0400	[thread overview]
Message-ID: <c2463cb0-c4bd-139b-be31-2e598cf74f66@purdue.edu> (raw)
In-Reply-To: <767a986316b6c934c29af5070cdd5dd4d3ba81e6.camel@redhat.com>

On 8/5/23 5:53 PM, David Malcolm wrote:
> ...but the warning branch uses "warning", which implicitly uses the
> input_location global variable.  Is the warning reported at the correct
> place?  It's better to use warning_at and pass it the location at which
> the warning should be emitted.

Thanks, I changed the patch to follow your suggestion.

I built and ran make check with the patch; there were no changes to the 
test results.

As a test, I again built GCC with

../../gcc-mainline/configure CXX="/pkgs/gcc-mainline-new-new/bin/g++ 
-Wdisabled-optimization" --enable-languages=c --disable-multilib 
--prefix=/pkgs/gcc-mainline-test-test --disable-werror --disable-bootstrap

I found no changes to the warning messages.

Brad

diff --git a/gcc/calls.cc b/gcc/calls.cc
index 1f3a6d5c450..de293ac51bb 100644
--- a/gcc/calls.cc
+++ b/gcc/calls.cc
@@ -1242,10 +1242,12 @@ void
  maybe_complain_about_tail_call (tree call_expr, const char *reason)
  {
    gcc_assert (TREE_CODE (call_expr) == CALL_EXPR);
-  if (!CALL_EXPR_MUST_TAIL_CALL (call_expr))
-    return;
-
-  error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", reason);
+  if (CALL_EXPR_MUST_TAIL_CALL (call_expr))
+    error_at (EXPR_LOCATION (call_expr), "cannot tail-call: %s", reason);
+  else if (flag_optimize_sibling_calls)
+    warning_at (EXPR_LOCATION (call_expr), OPT_Wdisabled_optimization,
+                "cannot apply sibling-call optimization: %s", reason);
+  return;
  }

  /* Fill in ARGS_SIZE and ARGS array based on the parameters found in

  reply	other threads:[~2023-08-06 18:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04 17:57 Bradley Lucier
2023-08-05 20:58 ` Prathamesh Kulkarni
2023-08-05 21:37   ` Bradley Lucier
2023-08-05 21:41     ` Prathamesh Kulkarni
2023-08-05 21:53   ` David Malcolm
2023-08-06 18:29     ` Bradley Lucier [this message]
2023-08-07  7:18     ` Richard Biener
2023-08-07 19:04       ` Bradley Lucier
2023-08-08  6:05         ` Richard Biener
2023-08-08 16:54           ` David Malcolm
2023-08-15 22:47             ` Bradley Lucier
2023-08-17  7:54               ` Richard Biener
2023-08-18 17:13                 ` Bradley Lucier
2023-08-21  7:47                   ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c2463cb0-c4bd-139b-be31-2e598cf74f66@purdue.edu \
    --to=lucier@purdue.edu \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=prathamesh.kulkarni@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).