[Mesa-dev] [PATCH] glsl: check if return_deref in lower_subroutine_visitor::visit_leave isn't NULL

Kai Wasserbäch kai at dev.carbon-project.org
Fri Aug 14 05:49:43 PDT 2015


Fixes a crash in Piglit's
spec at arb_shader_subroutine@linker at no-mutual-recursion.vert for me.

Signed-off-by: Kai Wasserbäch <kai at dev.carbon-project.org>
---

Hey everyone,
I ran the Piglit quick test suite afterwards and haven't observed any
regressions over my previous quick run, but the crash went away. The test
itself passes now! Instead of

| Program received signal SIGSEGV, Segmentation fault.
| (anonymous namespace)::lower_subroutine_visitor::visit_leave (this=0x7fffffffdab0, ir=0xb1af58) at ../../../../src/glsl/lower_subroutine.cpp:102

I'm seeing the (expected)

| Failed to link: error: function `void impl_b(int)' has static recursion.
| error: function `void impl_a(int)' has static recursion.
|
| Failed to link vertex shader <PIGLIT_SRC_DIR>/tests/spec/arb_shader_subroutine/linker/no-mutual-recursion.vert: 
| PIGLIT: {"result": "pass" }

The builds used in both runs have been done in a clean pbuilder chroot (the
same for both builds). Ie. there weren't any other differences between the two
Piglit runs besides the addition of the patch in the latest Mesa build.

If you accept this patch, please commit it for me, as I don't have commit
access.

Thanks,
Kai


 src/glsl/lower_subroutine.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/lower_subroutine.cpp b/src/glsl/lower_subroutine.cpp
index b29912a..c1aed61 100644
--- a/src/glsl/lower_subroutine.cpp
+++ b/src/glsl/lower_subroutine.cpp
@@ -98,7 +98,7 @@ lower_subroutine_visitor::visit_leave(ir_call *ir)
       else
          last_branch = if_tree(equal(subr_to_int(var), lc), new_call, last_branch);
 
-      if (s > 0)
+      if (return_deref && s > 0)
         return_deref = return_deref->clone(mem_ctx, NULL);
    }
    if (last_branch)
-- 
2.5.0



More information about the mesa-dev mailing list