From: Carl Worth Date: Thu, 2 Feb 2012 19:27:55 +0000 (-0800) Subject: glsl: Add glcpp tests for a macro used twice X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=64fd26a8a812f66f1291d897df7953b8ac9e2f1b;p=mesa.git glsl: Add glcpp tests for a macro used twice This test cases exposes a bug as described in this bug report: "ralloc.c:78: get_header: Assertion `info->canary == 0x5A1106' failed." when using a macro in GLSL https://bugs.freedesktop.org/show_bug.cgi?id=45082 Clearly, some memory is getting (incorrectly) freed on the first macro invocation, leading to problems with the second macro invocation. Reviewed-by: Kenneth Graunke --- diff --git a/src/glsl/glcpp/tests/101-macros-used-twice.c b/src/glsl/glcpp/tests/101-macros-used-twice.c new file mode 100644 index 00000000000..e1693805b6a --- /dev/null +++ b/src/glsl/glcpp/tests/101-macros-used-twice.c @@ -0,0 +1,16 @@ +#define object 1 +#define function(x) 1 + +#if object +once +#endif +#if object +twice +#endif + +#if function(0) +once +#endif +#if function(0) +once again +#endif diff --git a/src/glsl/glcpp/tests/101-macros-used-twice.c.expected b/src/glsl/glcpp/tests/101-macros-used-twice.c.expected new file mode 100644 index 00000000000..1a4bf15362b --- /dev/null +++ b/src/glsl/glcpp/tests/101-macros-used-twice.c.expected @@ -0,0 +1,17 @@ + + + + +once + + +twice + + + +once + + +once again + +