re PR other/79250 (brig/brigfrontend/brig-to-generic.cc: two small problems)
authorPekka Jääskeläinen <pekka.jaaskelainen@parmance.com>
Wed, 1 Feb 2017 10:06:13 +0000 (10:06 +0000)
committerPekka Jääskeläinen <visit0r@gcc.gnu.org>
Wed, 1 Feb 2017 10:06:13 +0000 (10:06 +0000)
* 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

From-SVN: r245084

gcc/brig/ChangeLog
gcc/brig/brigfrontend/brig-code-entry-handler.cc
gcc/brig/brigfrontend/brig-lane-inst-handler.cc
gcc/brig/brigfrontend/brig-to-generic.cc

index 79035a2..9f9a27e 100644 (file)
@@ -1,3 +1,12 @@
+2016-02-01  Pekka Jääskeläinen  <pekka.jaaskelainen@parmance.com>
+
+       * 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  <jakub@redhat.com>
 
        * brigfrontend/brig-code-entry-handler.cc
index eb32c51..08e49f9 100644 (file)
@@ -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)
index bc85c03..c81ee6a 100644 (file)
@@ -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);
     }
index 1672158..d113bdc 100644 (file)
@@ -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;
        }
     }