Hi.

The patch is about using Optimization for warn_inline as
it's affected by -O0.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Thanks,
Martin

gcc/ChangeLog:

2019-12-11  Martin Liska  <mli...@suse.cz>

        PR tree-optimization/92860
        * common.opt: Make in Optimization option
        as it is affected by -O0, which is an Optimization
        option.
        * tree-inline.c (tree_inlinable_function_p):
        Use opt_for_fn for warn_inline.
        (expand_call_inline): Likewise.

gcc/testsuite/ChangeLog:

2019-12-11  Martin Liska  <mli...@suse.cz>

        PR tree-optimization/92860
        * gcc.dg/pr92860.c: New test.
---
 gcc/common.opt                 |  2 +-
 gcc/testsuite/gcc.dg/pr92860.c | 13 +++++++++++++
 gcc/tree-inline.c              |  4 ++--
 3 files changed, 16 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/pr92860.c


diff --git a/gcc/common.opt b/gcc/common.opt
index a22ab004d65..53cc7501d68 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -617,7 +617,7 @@ Common Var(warn_implicit_fallthrough) RejectNegative Joined UInteger Warning Int
 Warn when a switch case falls through.
 
 Winline
-Common Var(warn_inline) Warning
+Common Var(warn_inline) Warning Optimization
 Warn when an inlined function cannot be inlined.
 
 Winvalid-memory-model
diff --git a/gcc/testsuite/gcc.dg/pr92860.c b/gcc/testsuite/gcc.dg/pr92860.c
new file mode 100644
index 00000000000..57af6068848
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr92860.c
@@ -0,0 +1,13 @@
+/* PR tree-optimization/92860 */
+/* { dg-do compile } */
+/* { dg-options "-Winline -O2 -fgnu89-inline" } */
+
+#pragma GCC push_options
+#pragma GCC optimize("-O0")
+#pragma GCC pop_options
+
+inline int q(void);		 /* { dg-warning "body not available" } */
+inline int t(void)
+{
+	return q();		 /* { dg-message "called from here" } */
+}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 21a45255051..58c6739eb7e 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4009,7 +4009,7 @@ tree_inlinable_function_p (tree fn)
     return false;
 
   /* We only warn for functions declared `inline' by the user.  */
-  do_warning = (warn_inline
+  do_warning = (opt_for_fn (fn, warn_inline)
 		&& DECL_DECLARED_INLINE_P (fn)
 		&& !DECL_NO_INLINE_WARNING_P (fn)
 		&& !DECL_IN_SYSTEM_HEADER (fn));
@@ -4714,7 +4714,7 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id,
 	    inform (DECL_SOURCE_LOCATION (cfun->decl),
                    "called from this function");
 	}
-      else if (warn_inline
+      else if (opt_for_fn (fn, warn_inline)
 	       && DECL_DECLARED_INLINE_P (fn)
 	       && !DECL_NO_INLINE_WARNING_P (fn)
 	       && !DECL_IN_SYSTEM_HEADER (fn)

Reply via email to