From c0f9e813e333d77f50cf6ca89a8dafc96eeb5d96 Mon Sep 17 00:00:00 2001 From: visit0r Date: Wed, 1 Feb 2017 10:06:13 +0000 Subject: * brigfrontend/brig-code-entry-handler.cc: fix address expressions which refer only to offset 0, but nothing else. * brigfrontend/brig-lane-inst-handler.cc: fix activelanepermute_b64 HSAIL instruction. * brigfrontend/brig-to-generic.cc: remove useless c_str() call. Add missing va_end (). Fix PR79250 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245084 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/brig/ChangeLog | 9 +++++++++ gcc/brig/brigfrontend/brig-code-entry-handler.cc | 8 ++++++-- gcc/brig/brigfrontend/brig-lane-inst-handler.cc | 3 ++- gcc/brig/brigfrontend/brig-to-generic.cc | 3 ++- 4 files changed, 19 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/brig/ChangeLog b/gcc/brig/ChangeLog index 79035a2fc47..9f9a27eb6f4 100644 --- a/gcc/brig/ChangeLog +++ b/gcc/brig/ChangeLog @@ -1,3 +1,12 @@ +2016-02-01 Pekka Jääskeläinen + + * brigfrontend/brig-code-entry-handler.cc: fix address + expressions which refer only to offset 0, but nothing else. + * brigfrontend/brig-lane-inst-handler.cc: fix + activelanepermute_b64 HSAIL instruction. + * brigfrontend/brig-to-generic.cc: remove useless c_str() + call. Add missing va_end (). Fix PR79250. + 2017-01-30 Jakub Jelinek * brigfrontend/brig-code-entry-handler.cc diff --git a/gcc/brig/brigfrontend/brig-code-entry-handler.cc b/gcc/brig/brigfrontend/brig-code-entry-handler.cc index eb32c51bc80..08e49f994a0 100644 --- a/gcc/brig/brigfrontend/brig-code-entry-handler.cc +++ b/gcc/brig/brigfrontend/brig-code-entry-handler.cc @@ -456,9 +456,13 @@ brig_code_entry_handler::build_address_operand /* We might have two const offsets in case of group or private arrays which have the first offset to the incoming group/private pointer - arg, and the second one an offset to it. */ + arg, and the second one an offset to it. It's also legal to have + a reference with a zero constant offset but no symbol. I've seen + codes that reference kernarg segment like this. Thus, if at this + point there is no address expression at all we assume it's an + access to offset 0. */ uint64_t offs = gccbrig_to_uint64_t (addr_operand.offset); - if (offs > 0) + if (offs > 0 || addr == NULL_TREE) { tree const_offset_2 = build_int_cst (size_type_node, offs); if (addr == NULL_TREE) diff --git a/gcc/brig/brigfrontend/brig-lane-inst-handler.cc b/gcc/brig/brigfrontend/brig-lane-inst-handler.cc index bc85c030071..c81ee6adefc 100644 --- a/gcc/brig/brigfrontend/brig-lane-inst-handler.cc +++ b/gcc/brig/brigfrontend/brig-lane-inst-handler.cc @@ -71,7 +71,8 @@ brig_lane_inst_handler::operator () (const BrigBase *base) itself or 'identity' in case use_identity is 1. */ tree cmp = build2 (EQ_EXPR, uint32_type_node, - build_int_cstu (uint32_type_node, 1), use_identity); + build_int_cstu (TREE_TYPE (use_identity), 1), + use_identity); expr = build3 (COND_EXPR, TREE_TYPE (src), cmp, identity, src); } diff --git a/gcc/brig/brigfrontend/brig-to-generic.cc b/gcc/brig/brigfrontend/brig-to-generic.cc index 1672158ffe5..d113bdcacf5 100644 --- a/gcc/brig/brigfrontend/brig-to-generic.cc +++ b/gcc/brig/brigfrontend/brig-to-generic.cc @@ -351,7 +351,7 @@ brig_to_generic::add_global_variable (const std::string &name, tree var_decl) std::string host_def_var_name = std::string (PHSA_HOST_DEF_PTR_PREFIX) + name; - tree host_def_var = global_variable (host_def_var_name.c_str ()); + tree host_def_var = global_variable (host_def_var_name); if (host_def_var == NULL_TREE) return; @@ -681,6 +681,7 @@ call_builtin (tree pdecl, int nargs, tree rettype, ...) { delete[] types; delete[] args; + va_end (ap); return error_mark_node; } } -- cgit v1.2.1