produced.
As observed in PR20991 for already optimized out comdat virtual functions
- it may be tempting to not neccesarily give up because the copy will be
+ it may be tempting to not necessarily give up because the copy will be
output elsewhere when corresponding vtable is output.
This is however not possible - ABI specify that COMDATs are output in
units where they are used and when the other unit was compiled with LTO
if (TREE_CODE (cval) == ADDR_EXPR)
{
tree base = get_base_address (TREE_OPERAND (cval, 0));
+ if (!base && TREE_CODE (TREE_OPERAND (cval, 0)) == COMPOUND_LITERAL_EXPR)
+ {
+ base = COMPOUND_LITERAL_EXPR_DECL (TREE_OPERAND (cval, 0));
+ if (base)
+ TREE_OPERAND (cval, 0) = base;
+ }
if (!base)
return NULL_TREE;
if (TREE_CODE (base) == VAR_DECL)
{
TREE_ADDRESSABLE (base) = 1;
- if (cfun && gimple_referenced_vars (cfun))
+ if (cfun && gimple_referenced_vars (cfun)
+ && !is_global_var (base))
add_referenced_var (base);
}
else if (TREE_CODE (base) == FUNCTION_DECL)
type = TREE_TYPE (fld);
offset -= pos;
}
- /* Artifical sub-objects are ancestors, we do not want to use them for
+ /* Artificial sub-objects are ancestors, we do not want to use them for
devirtualization, at least not here. */
if (last_artificial)
return NULL_TREE;