[PATH] PR/49139 fix always_inline failures diagnostics

Richard Guenther richard.guenther@gmail.com
Mon Jun 20 13:51:00 GMT 2011


On Mon, Jun 20, 2011 at 3:32 PM, Christian Bruel <christian.bruel@st.com> wrote:
> In addition to the approved part of the patch, I finally got the testsuite
> and a full Linux distribution to build without false warnings, with the
> additional following changes:
>
> * two false warnings detected during a Linux distrib rebuild
>
>  - __typeof (__error) doesn't propagate the inline keyword. even if the
> function had attribute always_inline.
>  - extern inline function redefinition would inherit the attribute, even if
> they are not inline
>
>  DECL_UNINLINABLE is set for redefining extern inline functions. (commented
> in c-decl.c:2340). So indeed testing this flags in the cgraphunit.c part
> fixed both.
>  I checked that this doesn't conflict with other DECL_UNINLINABLE warning
> emitted from ree_inlinable_function_p. (which is called after)
>
> * One silent bug revealed, undetected in the GCC testuite:
>
>  - PR43564.c compiled in -O0, the "__clz" function was silently not inlined.
> Fixed in ipa-inline.c:inline_forbidden_p_stmt

-      if ((caller_opt->x_optimize > callee_opt->x_optimize)
-	  || (caller_opt->x_optimize_size != callee_opt->x_optimize_size))
+      if (((caller_opt->x_optimize > callee_opt->x_optimize)
+	   || (caller_opt->x_optimize_size != callee_opt->x_optimize_size))
+	  /* gcc.dg/pr43564.c.  look at forced inline even in -O0.  */
+	  && !lookup_attribute ("always_inline", DECL_ATTRIBUTES (e->callee->decl)))

please check DECL_DISREGARD_INLINE_LIMITS instead.

> * LTO pitfall: It's OK to not have a body to inline when generating the LTO
> Gimple. Enforced by PR20090218-1_0.c

I'm not 100% sure here ;)  At least as we still output a regular object
file without the function being inlined.  But as we're going towars
slim-LTO (hopefully) I guess it's ok.

> * In addition to the parts of the patch that was approved, I had to fix the
> tests that didn't use the inline keyword but enforced the always_inline
> attribute to pass without the warning
>  I choose to add -Wno-attributes to the option list. Could as well fix the
> test by adding the inline keyword, but I preferred to not modify the
> original test when possible.
>
> * A minor code optimization in ipa-inline-transform.c: Don't call
> optimize_inline_calls if there is not callee.
>
> Comments, OK to apply ?

Ok with the above change and the PRs mentioned in the changelog
properly (see Rainers comment).

Thanks,
Richard.

> Many thanks
>
> Christian
>
> 2011-06-16  Christian Bruel  <christian.bruel@st.com>
>
>        PR 49139/43654
>        * cgraphunit.c (process_function_and_variable_attributes): warn
>        for always_inline functions that are not inline.
>        * ipa-inline-transform.c (inline_transform): Always call
>        optimize_inline.
>        * ipa-inline.c (can_inline_edge_p): Check always_inline.
>        * tree-inline.c (tree_inlinable_function_p): Call error instead
>        of sorry.
>        (expand_call_inline): Likewise.
>
> 2011-06-16  Christian Bruel  <christian.bruel@st.com>
>
>        * gcc.dg/always_inline.c: Removed -Winline. Update checks
>        * gcc.dg/always_inline2.c: Likewise.
>        * gcc.dg/always_inline3.c: Likewise.
>        * gcc.dg/debug/pr41264-1.c: Add -Wno-attributes.
>        * gcc.dg/inline_1.c: Likewise.
>        * gcc.dg/inline_2.c: Likewise.
>        * gcc.dg/inline_3.c: Likewise.
>        * gcc.dg/inline_4.c: Likewise.
>        * gcc.dg/20051201-1.c: Likewise.
>        * gcc.dg/torture/pta-structcopy-1.c: Likewise.
>        * gcc.dg/inline-22.c: Likewise.
>        * gcc.dg/lto/20090218-1_0.c: Set inline keyword.
>        * gcc.dg/lto/20090218-1_1.c: Likewise.
>        * g++.dg/ipa/devirt-7.C: Likewise.
>        * gcc.dg/uninit-pred-5_a.c: Likewise.
>        * gcc.dg/uninit-pred-5_b.c: Likewise.
>        * gcc.dg/fail_always_inline.c: New.
>



More information about the Gcc-patches mailing list