glsl: Update loop_terminator constructor to accept parameters.
authorVinson Lee <vlee@freedesktop.org>
Fri, 23 Oct 2020 00:31:19 +0000 (17:31 -0700)
committerVinson Lee <vlee@freedesktop.org>
Thu, 29 Oct 2020 02:28:40 +0000 (19:28 -0700)
Fix defect reported by Coverity Scan.

Uninitialized scalar field (UNINIT_CTOR)
uninit_member: Non-static class member continue_from_then is not
initialized in this constructor nor in any functions that it calls.

Suggested-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7283>

src/compiler/glsl/loop_analysis.cpp
src/compiler/glsl/loop_analysis.h

index 6f0b328..301b7f3 100644 (file)
@@ -355,10 +355,8 @@ loop_terminator *
 loop_variable_state::insert(ir_if *if_stmt, bool continue_from_then)
 {
    void *mem_ctx = ralloc_parent(this);
-   loop_terminator *t = new(mem_ctx) loop_terminator();
-
-   t->ir = if_stmt;
-   t->continue_from_then = continue_from_then;
+   loop_terminator *t = new(mem_ctx) loop_terminator(if_stmt,
+                                                     continue_from_then);
 
    this->terminators.push_tail(t);
 
index d6fdb90..8d65b13 100644 (file)
@@ -194,8 +194,8 @@ public:
 
 class loop_terminator : public exec_node {
 public:
-   loop_terminator()
-      : ir(NULL), iterations(-1)
+   loop_terminator(ir_if *ir, bool continue_from_then)
+      : ir(ir), iterations(-1), continue_from_then(continue_from_then)
    {
    }