> Jan,
> it looks like your recent changes to
> function_and_variable_visibility and friends causes regressions in
> targets that do not support aliases (PTX for example).
> 
> specifically, we get a segfault  in update_vtable_references 
> (ipa-visibility.c) at
>       *tp = symtab_node::get (*tp)->noninterposable_alias ()->decl;
> 
> because symtab_node::noninterposable_alias (symtab.c) returns NULL.
> It does this on targets that do not support aliases:
> 
> #ifndef ASM_OUTPUT_DEF
>   /* If aliases aren't supported by the assembler, fail.  */
>   return NULL;
> #endif
> 
> and update_vtable_references doesn't anticipate that happening,
> blindly dereferencing the returned value.  Is  the fix:
> 
> a) add  a check in update_vtable_references on noninterposable_alias's return 
> value?
> 
> b) augment can_replace_by_local_alias_in_vtable to check whether
> aliases can be created?

I think this is best: can_replace_by_local_alias_in_vtable exists to prevent the
body walk in cases we are not going to create the alias.  This is because in LTO
we may need to stream in the constructor from the object file that is not 
copletely
free and thus it is better to not touch it unless necessary.

Thanks for looking into this!
Honza
> 
> c) augment function_and_variable_visibility to not attempt such replacement:
>       /* Update virtual tables to point to local aliases where possible.  */
>       if (DECL_VIRTUAL_P (vnode->decl)
>         && !DECL_EXTERNAL (vnode->decl))
>       ...
> d) something else?
> 
> nathan

Reply via email to