[Piglit] [PATCH] mingw: build shader_runner with 2MB stack

Brian Paul brianp at vmware.com
Thu Oct 12 16:51:43 UTC 2017


The op-selection-bool-bvec4-bvec4.frag test has an expression which
adds 512 terms.  This causes 512 levels of recursion in Mesa's
ir_expression::constant_expression_value() function.  Since each
function activation record is about 2KB in size with MSVC, this
causes us to overflow the stack and crash.

The crash was only recently exposed with MSVC 2015 debug builds of Mesa.

In the top-level CMakeLists.txt file we set the default stack size
to 1MB to match MSVC.  Here, we override that to be 2MB for
shader_runner.exe  Note that this causes two -Wl,--stack,XXX flags
to be passed to the linker.  But the later one specifying 2MB wins.
Perhaps there's a way to avoid that in CMake.
---
 tests/shaders/CMakeLists.gl.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/shaders/CMakeLists.gl.txt b/tests/shaders/CMakeLists.gl.txt
index 1dbd953..1c06843 100644
--- a/tests/shaders/CMakeLists.gl.txt
+++ b/tests/shaders/CMakeLists.gl.txt
@@ -131,7 +131,12 @@ piglit_add_executable (glsl-mat-attribute glsl-mat-attribute.c)
 piglit_add_executable (glsl-max-varyings glsl-max-varyings.c)
 piglit_add_executable (glsl-useprogram-displaylist glsl-useprogram-displaylist.c)
 piglit_add_executable (glsl-routing glsl-routing.c)
+
 piglit_add_executable (shader_runner shader_runner.c parser_utils.c)
+IF (MINGW)
+	set_target_properties(shader_runner PROPERTIES LINK_FLAGS  "-Wl,--stack,2097152")
+ENDIF ()
+
 piglit_add_executable (glsl-vs-point-size glsl-vs-point-size.c)
 piglit_add_executable (glsl-sin glsl-sin.c)
 IF (UNIX)
-- 
1.9.1



More information about the Piglit mailing list