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: [google]: initialize language field for clone function struct


On Tue, May 3, 2011 at 3:55 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>> Is this one ok?
> Hi,
> we did quite some work on removing a langhooks for LTO, where they become quite impossible
> So I would like to know what testcase causes the problem and why.

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.


Thanks,

David


>
> Honza
>>
>> David
>>
>> On Fri, Apr 29, 2011 at 4:38 PM, Xinliang David Li <davidxl@google.com> wrote:
>> > During function cloning, the language field of the src func is not
>> > copied. This can lead to null dereference when gcc calls into langhook
>> > functions. ?Unfortunately, I lost track of the test case.
>> >
>> > Ok for trunk ?
>> >
>> > Thanks,
>> >
>> > David
>> >
>> >
>> > 2011-04-29 ?Xinliang David Li ?<davidxl@google.com>
>> >
>> > ? ? ? ?* tree-inline.c (ininitialize_cfun): Initialize
>> > ? ? ? ?language field for clone cfun.
>> >
>


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