On 06/23/2016 08:45 AM, Alexander Monakov wrote:
Hi,
I've discovered that this assert in my patch was too restrictive:
+ if (DECL_HAS_VALUE_EXPR_P (pv->decl))
+ {
+ gcc_checking_assert (lookup_attribute ("omp declare target link",
+ DECL_ATTRIBUTES (pv->decl)));
Testing for the nvptx target uncovered that there's another case where a
global variable would have a value expr: emutls. Sorry for not spotting it
earlier (but at least the new assert did its job). I think we should always
skip here over decls that have value-exprs, just like hard-reg vars are
skipped. The following patch does that. Is this still OK?
(bootstrapped/regtested on x86-64)
Alexander
* cgraphunit.c (cgraph_order_sort_kind): New entry ORDER_VAR_UNDEF.
(output_in_order): Loop over undefined variables too. Output them
via assemble_undefined_decl. Skip variables that correspond to hard
registers or have value-exprs.
* varpool.c (symbol_table::output_variables): Handle undefined
variables together with defined ones.
OK. Thanks for your patience.
jeff