[Mesa-dev] [PATCH] r600g/sb: Initialize cf_node::bc.

Vadim Girlin vadimgirlin at gmail.com
Sun Aug 18 21:39:27 PDT 2013


On 08/19/2013 01:35 AM, Vinson Lee wrote:
> Fixes "Uninitialized pointer field" defect reported by Coverity.
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   src/gallium/drivers/r600/sb/sb_ir.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/sb/sb_ir.h b/src/gallium/drivers/r600/sb/sb_ir.h
> index c838f62..b696e77 100644
> --- a/src/gallium/drivers/r600/sb/sb_ir.h
> +++ b/src/gallium/drivers/r600/sb/sb_ir.h
> @@ -962,8 +962,8 @@ public:
>
>   class cf_node : public container_node {
>   protected:
> -	cf_node() : container_node(NT_OP, NST_CF_INST), jump_target(),
> -		jump_after_target() {};
> +	cf_node() : container_node(NT_OP, NST_CF_INST), bc(),
> +		jump_target(), jump_after_target() {};

Hi, Vinson,

IIRC I switched the initialization of bc struct from constructor 
initializer list to explicit memset due to reported issues with older 
gcc versions, it failed to initialize the struct properly. See commit 
41005d.

Constructors of cf_node (as well as fetch_node, alu_node) are protected 
and called only by helper functions (create_cf, create_fetch, 
create_alu) in friend class r600_sb::shader that create nodes in pool, 
memset for bc is called right after constructor in these functions, so 
actually bc is always initialized. I don't remember why I didn't use 
memset in constructor body though, maybe moving memset there would 
silence Coverity?

Vadim

>   public:
>   	bc_cf bc;
>
>



More information about the mesa-dev mailing list