> In fold-const.c, there are many of calls to
> lang_hooks.decls.global_bindings_p, and the implementation of this in
> name-lookup.h will look at the the cfun->language
> 
> 
> #define cp_function_chain (cfun->language)
> 
> #define current_binding_level                 \
>   (*(cfun && cp_function_chain && cp_function_chain->bindings \
>    ? &cp_function_chain->bindings             \
> 
> int
> global_bindings_p (void)
> {
>   return global_scope_p (current_binding_level);
> }
> 
> 
> In gcc 4.4.3, current_binding_level is defined in a way that
> cp_function_chain->bindings is not guarded, resulting in segfault for
> clones. In trunk, this is guarded -- but not setting language field
> for clone probably just hide the problem.

Indeed, it seems to me that global_bindings_p should go, clearly the LTO does
not preserve its behaviour in any sane way.
I am however completely missing the point of this langhook and doc is not 
exactly
informative either:

  /* Returns nonzero if we are in the global binding level.  Ada
     returns -1 for an undocumented reason used in stor-layout.c.  */

What is the purpose of this hook?

Honza

Reply via email to