[Mesa-dev] [PATCH] nir: Mark the shader name during nir_sweep

Neil Roberts neil at linux.intel.com
Thu Oct 8 07:58:50 PDT 2015


Previously the name of the nir shader was being freed prematurely
during nir_sweep. Since 756613ed35d the name was later being used to
generate filenames for the optimiser debug output and these would end
up with garbage from the dangling pointer.
---
 src/glsl/nir/nir_sweep.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/glsl/nir/nir_sweep.c b/src/glsl/nir/nir_sweep.c
index d354975..082403f 100644
--- a/src/glsl/nir/nir_sweep.c
+++ b/src/glsl/nir/nir_sweep.c
@@ -154,6 +154,9 @@ nir_sweep(nir_shader *nir)
    /* First, move ownership of all the memory to a temporary context; assume dead. */
    ralloc_adopt(rubbish, nir);
 
+   /* The shader name is not dead */
+   ralloc_steal(nir, nir->info.name);
+
    /* Variables and registers are not dead.  Steal them back. */
    steal_list(nir, nir_variable, &nir->uniforms);
    steal_list(nir, nir_variable, &nir->inputs);
-- 
1.9.3



More information about the mesa-dev mailing list