This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][C] Fix GNU extern inline heuristic again (fix C++ memory usage regression)


"Dave Korn" <dave.korn@artimi.com> writes:

> On 27 August 2007 19:15, Ian Lance Taylor wrote:
> 
> > Richard Guenther <rguenther@suse.de> writes:
> > 
> >> +   /* For GNU C extern inline functions disregard inline limits.  */
> >> +   if (DECL_EXTERNAL (fndecl)
> >> +       && DECL_DECLARED_INLINE_P (fndecl))
> >> +     DECL_DISREGARD_INLINE_LIMITS (fndecl) = 1;
> > 
> > You may have found a bug here.  I see that you are just replicating
> > the existing code.  But a GNU C extern inline function is not the same
> > as a C99 extern inline function.  I don't see any obvious reason why
> > we should disregard inline limits for a C99 extern inline function.
> 
>   Did you see http://gcc.gnu.org/ml/gcc-patches/2007-08/msg01832.html ?

I saw it but did not interpret it correctly.

I see, it's from this code in c-decl.c:merge_decls:

  /* In c99, 'extern' declaration before (or after) 'inline' means this
     function is not DECL_EXTERNAL, unless 'gnu_inline' attribute
     is present.  */
  if (TREE_CODE (newdecl) == FUNCTION_DECL
      && !flag_gnu89_inline
      && (DECL_DECLARED_INLINE_P (newdecl)
	  || DECL_DECLARED_INLINE_P (olddecl))
      && (!DECL_DECLARED_INLINE_P (newdecl)
	  || !DECL_DECLARED_INLINE_P (olddecl)
	  || !DECL_EXTERNAL (olddecl))
      && DECL_EXTERNAL (newdecl)
      && !lookup_attribute ("gnu_inline", DECL_ATTRIBUTES (newdecl)))
    DECL_EXTERNAL (newdecl) = 0;


OK, I withdraw that objection, but I still wonder if it would make
sense to not add the attribute.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]