Hello. In the following patch, I fix usage of an uninitialized variable: hsa_cfun->decl. Installed as revision 228659.
Thanks, Martin
>From 7f85ed1c1d3f2fe6132117f58c84af33cb709689 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Fri, 9 Oct 2015 15:06:46 +0200 Subject: [PATCH 1/7] HSA: fix usage of uninitialized variable in hsa_function_representation gcc/ChangeLog: 2015-10-09 Martin Liska <mli...@suse.cz> * hsa-gen.c (hsa_function_representation::hsa_function_representation): Change arguments of the constructor. (hsa_init_data_for_cfun): Remove creation of hsa_cfun from this function. (generate_hsa): Move it here. * hsa.h (hsa_function_representation::hsa_function_representation): Declare. --- gcc/hsa-gen.c | 11 +++++------ gcc/hsa.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index cf36882..a5099b6 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -202,7 +202,8 @@ static vec <hsa_op_immed*> hsa_list_operand_immed; /* TODO: Move more initialization here. */ -hsa_function_representation::hsa_function_representation () +hsa_function_representation::hsa_function_representation + (tree fdecl, bool kernel_p): kern_p (kernel_p), decl (fdecl) { name = NULL; input_args_count = 0; @@ -216,7 +217,6 @@ hsa_function_representation::hsa_function_representation () readonly_variables = vNULL; hbb_count = 0; in_ssa = true; /* We start in SSA. */ - kern_p = false; declaration_p = false; called_functions = vNULL; shadow_reg = NULL; @@ -313,7 +313,6 @@ hsa_init_data_for_cfun () = new object_allocator<hsa_insn_queue> ("HSA queue instructions"); hsa_allocp_bb = new object_allocator<hsa_bb> ("HSA basic blocks"); hsa_allocp_symbols = new object_allocator<hsa_symbol> ("HSA symbols"); - hsa_cfun = new hsa_function_representation (); /* The entry/exit blocks don't contain incoming code, but the HSA generator might use them to put code into, @@ -5121,14 +5120,14 @@ generate_hsa (bool kernel) if (hsa_num_threads == NULL) emit_hsa_module_variables (); + /* Initialize hsa_cfun. */ + hsa_cfun = new hsa_function_representation (cfun->decl, kernel); hsa_init_data_for_cfun (); + verify_function_arguments (cfun->decl); if (hsa_seen_error ()) goto fail; - hsa_cfun->decl = cfun->decl; - hsa_cfun->kern_p = kernel; - host_decl = hsa_get_host_function (current_function_decl); ssa_map.safe_grow_cleared (SSANAMES (cfun)->length ()); hsa_cfun->name = xstrdup (hsa_get_declaration_name (host_decl)); diff --git a/gcc/hsa.h b/gcc/hsa.h index 98d70e0..fbc6684 100644 --- a/gcc/hsa.h +++ b/gcc/hsa.h @@ -908,7 +908,7 @@ hsa_free_symbol_hasher::equal (const value_type a, const compare_type b) class hsa_function_representation { public: - hsa_function_representation (); + hsa_function_representation (tree fdecl, bool kernel_p); ~hsa_function_representation (); /* Builds a shadow register that is utilized to a kernel dispatch. */ -- 2.5.1