Mesa (master): glsl: Add glcpp tests for a macro used twice

Carl Worth cworth at kemper.freedesktop.org
Thu Feb 2 21:29:45 UTC 2012


Module: Mesa
Branch: master
Commit: 64fd26a8a812f66f1291d897df7953b8ac9e2f1b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=64fd26a8a812f66f1291d897df7953b8ac9e2f1b

Author: Carl Worth <cworth at cworth.org>
Date:   Thu Feb  2 11:27:55 2012 -0800

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 <kenneth at whitecape.org>

---

 src/glsl/glcpp/tests/101-macros-used-twice.c       |   16 ++++++++++++++++
 .../glcpp/tests/101-macros-used-twice.c.expected   |   17 +++++++++++++++++
 2 files changed, 33 insertions(+), 0 deletions(-)

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 0000000..e169380
--- /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 0000000..1a4bf15
--- /dev/null
+++ b/src/glsl/glcpp/tests/101-macros-used-twice.c.expected
@@ -0,0 +1,17 @@
+
+
+
+
+once
+
+
+twice
+
+
+
+once
+
+
+once again
+
+




More information about the mesa-commit mailing list