[Mesa-dev] [PATCH 5/5] glsl: add unit tests data vertex/expected outcome for unitialized warning

Alejandro PiƱeiro apinheiro at igalia.com
Tue May 10 07:13:29 UTC 2016


---
 .../glsl/tests/warnings/000-basic-test.vert        | 10 ++++++++
 .../tests/warnings/000-basic-test.vert.expected    |  1 +
 .../warnings/001-use-undefined-then-define.vert    | 12 ++++++++++
 .../001-use-undefined-then-define.vert.expected    |  1 +
 src/compiler/glsl/tests/warnings/002-loop.vert     | 23 ++++++++++++++++++
 .../glsl/tests/warnings/002-loop.vert.expected     |  3 +++
 src/compiler/glsl/tests/warnings/003-less.vert     | 17 +++++++++++++
 .../glsl/tests/warnings/003-less.vert.expected     |  1 +
 src/compiler/glsl/tests/warnings/004-greater.vert  | 17 +++++++++++++
 .../glsl/tests/warnings/004-greater.vert.expected  |  1 +
 src/compiler/glsl/tests/warnings/005-lequal.vert   | 17 +++++++++++++
 .../glsl/tests/warnings/005-lequal.vert.expected   |  1 +
 src/compiler/glsl/tests/warnings/006-gequal.vert   | 17 +++++++++++++
 .../glsl/tests/warnings/006-gequal.vert.expected   |  1 +
 src/compiler/glsl/tests/warnings/007-test-mod.vert | 25 +++++++++++++++++++
 .../glsl/tests/warnings/007-test-mod.vert.expected |  3 +++
 .../glsl/tests/warnings/008-mulassign.vert         | 12 ++++++++++
 .../tests/warnings/008-mulassign.vert.expected     |  1 +
 .../glsl/tests/warnings/009-div-assign.vert        | 12 ++++++++++
 .../tests/warnings/009-div-assign.vert.expected    |  1 +
 .../glsl/tests/warnings/010-add-assign.vert        | 12 ++++++++++
 .../tests/warnings/010-add-assign.vert.expected    |  1 +
 .../glsl/tests/warnings/011-sub-assign.vert        | 12 ++++++++++
 .../tests/warnings/011-sub-assign.vert.expected    |  1 +
 .../glsl/tests/warnings/012-modassign.vert         | 12 ++++++++++
 .../tests/warnings/012-modassign.vert.expected     |  1 +
 src/compiler/glsl/tests/warnings/013-lsassign.vert | 12 ++++++++++
 .../glsl/tests/warnings/013-lsassign.vert.expected |  1 +
 src/compiler/glsl/tests/warnings/014-rsassign.vert | 12 ++++++++++
 .../glsl/tests/warnings/014-rsassign.vert.expected |  1 +
 .../glsl/tests/warnings/015-andassign.vert         | 12 ++++++++++
 .../tests/warnings/015-andassign.vert.expected     |  1 +
 src/compiler/glsl/tests/warnings/016-orassign.vert | 12 ++++++++++
 .../glsl/tests/warnings/016-orassign.vert.expected |  1 +
 .../glsl/tests/warnings/017-xorassign.vert         | 12 ++++++++++
 .../tests/warnings/017-xorassign.vert.expected     |  1 +
 src/compiler/glsl/tests/warnings/018-bitand.vert   | 24 +++++++++++++++++++
 .../glsl/tests/warnings/018-bitand.vert.expected   |  3 +++
 src/compiler/glsl/tests/warnings/019-array.vert    | 23 ++++++++++++++++++
 .../glsl/tests/warnings/019-array.vert.expected    |  5 ++++
 .../glsl/tests/warnings/020-array-length.vert      | 12 ++++++++++
 .../tests/warnings/020-array-length.vert.expected  |  0
 src/compiler/glsl/tests/warnings/021-lshift.vert   | 25 +++++++++++++++++++
 .../glsl/tests/warnings/021-lshift.vert.expected   |  3 +++
 src/compiler/glsl/tests/warnings/022-rshift.vert   | 25 +++++++++++++++++++
 .../glsl/tests/warnings/022-rshift.vert.expected   |  3 +++
 src/compiler/glsl/tests/warnings/023-switch.vert   | 28 ++++++++++++++++++++++
 .../glsl/tests/warnings/023-switch.vert.expected   |  3 +++
 .../glsl/tests/warnings/024-shaderout.vert         | 19 +++++++++++++++
 .../tests/warnings/024-shaderout.vert.expected     |  2 ++
 .../025-out-inout-function-parameters.vert         | 16 +++++++++++++
 ...025-out-inout-function-parameters.vert.expected |  1 +
 .../glsl/tests/warnings/026-conditional.vert       | 17 +++++++++++++
 .../tests/warnings/026-conditional.vert.expected   |  6 +++++
 .../glsl/tests/warnings/027-fieldselection.vert    | 23 ++++++++++++++++++
 .../warnings/027-fieldselection.vert.expected      |  1 +
 56 files changed, 519 insertions(+)
 create mode 100644 src/compiler/glsl/tests/warnings/000-basic-test.vert
 create mode 100644 src/compiler/glsl/tests/warnings/000-basic-test.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert
 create mode 100644 src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/002-loop.vert
 create mode 100644 src/compiler/glsl/tests/warnings/002-loop.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/003-less.vert
 create mode 100644 src/compiler/glsl/tests/warnings/003-less.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/004-greater.vert
 create mode 100644 src/compiler/glsl/tests/warnings/004-greater.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/005-lequal.vert
 create mode 100644 src/compiler/glsl/tests/warnings/005-lequal.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/006-gequal.vert
 create mode 100644 src/compiler/glsl/tests/warnings/006-gequal.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/007-test-mod.vert
 create mode 100644 src/compiler/glsl/tests/warnings/007-test-mod.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/008-mulassign.vert
 create mode 100644 src/compiler/glsl/tests/warnings/008-mulassign.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/009-div-assign.vert
 create mode 100644 src/compiler/glsl/tests/warnings/009-div-assign.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/010-add-assign.vert
 create mode 100644 src/compiler/glsl/tests/warnings/010-add-assign.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/011-sub-assign.vert
 create mode 100644 src/compiler/glsl/tests/warnings/011-sub-assign.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/012-modassign.vert
 create mode 100644 src/compiler/glsl/tests/warnings/012-modassign.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/013-lsassign.vert
 create mode 100644 src/compiler/glsl/tests/warnings/013-lsassign.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/014-rsassign.vert
 create mode 100644 src/compiler/glsl/tests/warnings/014-rsassign.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/015-andassign.vert
 create mode 100644 src/compiler/glsl/tests/warnings/015-andassign.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/016-orassign.vert
 create mode 100644 src/compiler/glsl/tests/warnings/016-orassign.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/017-xorassign.vert
 create mode 100644 src/compiler/glsl/tests/warnings/017-xorassign.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/018-bitand.vert
 create mode 100644 src/compiler/glsl/tests/warnings/018-bitand.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/019-array.vert
 create mode 100644 src/compiler/glsl/tests/warnings/019-array.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/020-array-length.vert
 create mode 100644 src/compiler/glsl/tests/warnings/020-array-length.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/021-lshift.vert
 create mode 100644 src/compiler/glsl/tests/warnings/021-lshift.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/022-rshift.vert
 create mode 100644 src/compiler/glsl/tests/warnings/022-rshift.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/023-switch.vert
 create mode 100644 src/compiler/glsl/tests/warnings/023-switch.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/024-shaderout.vert
 create mode 100644 src/compiler/glsl/tests/warnings/024-shaderout.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/025-out-inout-function-parameters.vert
 create mode 100644 src/compiler/glsl/tests/warnings/025-out-inout-function-parameters.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/026-conditional.vert
 create mode 100644 src/compiler/glsl/tests/warnings/026-conditional.vert.expected
 create mode 100644 src/compiler/glsl/tests/warnings/027-fieldselection.vert
 create mode 100644 src/compiler/glsl/tests/warnings/027-fieldselection.vert.expected

diff --git a/src/compiler/glsl/tests/warnings/000-basic-test.vert b/src/compiler/glsl/tests/warnings/000-basic-test.vert
new file mode 100644
index 0000000..266eed6
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/000-basic-test.vert
@@ -0,0 +1,10 @@
+#version 130
+
+void main()
+{
+  float foo;
+  float undefined;
+
+  foo = undefined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/000-basic-test.vert.expected b/src/compiler/glsl/tests/warnings/000-basic-test.vert.expected
new file mode 100644
index 0000000..ed02a95
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/000-basic-test.vert.expected
@@ -0,0 +1 @@
+0:8(8): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert b/src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert
new file mode 100644
index 0000000..2175afe
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  float foo;
+  float undefinedThenDefined;
+
+  foo = undefinedThenDefined;
+  undefinedThenDefined = 2.0;
+  foo = undefinedThenDefined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert.expected b/src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert.expected
new file mode 100644
index 0000000..a036d67
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert.expected
@@ -0,0 +1 @@
+0:8(8): warning: `undefinedThenDefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/002-loop.vert b/src/compiler/glsl/tests/warnings/002-loop.vert
new file mode 100644
index 0000000..de05d9c
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/002-loop.vert
@@ -0,0 +1,23 @@
+#version 130
+
+void main()
+{
+   int i;
+   int undefined;
+   int undefined2;
+   int defined = 2;
+   float fooFloat;
+
+   for (i = 0; i < undefined; i++) {
+      fooFloat = 10.0;
+   }
+
+   for (; undefined < undefined2; i++) {
+      fooFloat = 10.0;
+   }
+
+   for (i = 0; i < defined; i++) {
+      fooFloat = 10.0;
+   }
+}
+
diff --git a/src/compiler/glsl/tests/warnings/002-loop.vert.expected b/src/compiler/glsl/tests/warnings/002-loop.vert.expected
new file mode 100644
index 0000000..7a51001
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/002-loop.vert.expected
@@ -0,0 +1,3 @@
+0:11(18): warning: `undefined' used uninitialized
+0:15(9): warning: `undefined' used uninitialized
+0:15(21): warning: `undefined2' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/003-less.vert b/src/compiler/glsl/tests/warnings/003-less.vert
new file mode 100644
index 0000000..bbab55a
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/003-less.vert
@@ -0,0 +1,17 @@
+#version 130
+
+void main()
+{
+   int undefined;
+   int defined = 2;
+   float fooFloat;
+
+   if (undefined < 0) {
+      fooFloat = 10.0;
+   }
+
+   if (defined < 0) {
+      fooFloat = 10.0;
+   }
+}
+
diff --git a/src/compiler/glsl/tests/warnings/003-less.vert.expected b/src/compiler/glsl/tests/warnings/003-less.vert.expected
new file mode 100644
index 0000000..93cd789
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/003-less.vert.expected
@@ -0,0 +1 @@
+0:9(6): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/004-greater.vert b/src/compiler/glsl/tests/warnings/004-greater.vert
new file mode 100644
index 0000000..c9842e5
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/004-greater.vert
@@ -0,0 +1,17 @@
+#version 130
+
+void main()
+{
+   int undefined;
+   int defined = 2;
+   float fooFloat;
+
+   if (undefined > 0) {
+      fooFloat = 10.0;
+   }
+
+   if (defined > 0) {
+      fooFloat = 10.0;
+   }
+}
+
diff --git a/src/compiler/glsl/tests/warnings/004-greater.vert.expected b/src/compiler/glsl/tests/warnings/004-greater.vert.expected
new file mode 100644
index 0000000..93cd789
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/004-greater.vert.expected
@@ -0,0 +1 @@
+0:9(6): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/005-lequal.vert b/src/compiler/glsl/tests/warnings/005-lequal.vert
new file mode 100644
index 0000000..73e476a
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/005-lequal.vert
@@ -0,0 +1,17 @@
+#version 130
+
+void main()
+{
+   int undefined;
+   int defined = 2;
+   float fooFloat;
+
+   if (undefined <= 0) {
+      fooFloat = 10.0;
+   }
+
+   if (defined <= 0) {
+      fooFloat = 10.0;
+   }
+}
+
diff --git a/src/compiler/glsl/tests/warnings/005-lequal.vert.expected b/src/compiler/glsl/tests/warnings/005-lequal.vert.expected
new file mode 100644
index 0000000..93cd789
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/005-lequal.vert.expected
@@ -0,0 +1 @@
+0:9(6): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/006-gequal.vert b/src/compiler/glsl/tests/warnings/006-gequal.vert
new file mode 100644
index 0000000..f1694bd
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/006-gequal.vert
@@ -0,0 +1,17 @@
+#version 130
+
+void main()
+{
+   int undefined;
+   int defined = 2;
+   float fooFloat;
+
+   if (undefined >= 0) {
+      fooFloat = 10.0;
+   }
+
+   if (defined >= 0) {
+      fooFloat = 10.0;
+   }
+}
+
diff --git a/src/compiler/glsl/tests/warnings/006-gequal.vert.expected b/src/compiler/glsl/tests/warnings/006-gequal.vert.expected
new file mode 100644
index 0000000..93cd789
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/006-gequal.vert.expected
@@ -0,0 +1 @@
+0:9(6): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/007-test-mod.vert b/src/compiler/glsl/tests/warnings/007-test-mod.vert
new file mode 100644
index 0000000..2881db8
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/007-test-mod.vert
@@ -0,0 +1,25 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  float fooFloat;
+
+  if (undefined % 2 == 0) {
+    fooFloat = 10.0;
+  }
+
+  if (defined % 2 == 0) {
+    fooFloat = 10.0;
+  }
+
+  if (undefined % defined == 0) {
+    fooFloat = 10.0;
+  }
+
+  if (defined % undefined == 0) {
+    fooFloat = 10.0;
+  }
+}
+
diff --git a/src/compiler/glsl/tests/warnings/007-test-mod.vert.expected b/src/compiler/glsl/tests/warnings/007-test-mod.vert.expected
new file mode 100644
index 0000000..78613d5
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/007-test-mod.vert.expected
@@ -0,0 +1,3 @@
+0:9(6): warning: `undefined' used uninitialized
+0:17(6): warning: `undefined' used uninitialized
+0:21(16): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/008-mulassign.vert b/src/compiler/glsl/tests/warnings/008-mulassign.vert
new file mode 100644
index 0000000..0923891
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/008-mulassign.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  int fooInt;
+
+  fooInt *= undefined;
+  fooInt *= defined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/008-mulassign.vert.expected b/src/compiler/glsl/tests/warnings/008-mulassign.vert.expected
new file mode 100644
index 0000000..8fbb408
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/008-mulassign.vert.expected
@@ -0,0 +1 @@
+0:9(12): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/009-div-assign.vert b/src/compiler/glsl/tests/warnings/009-div-assign.vert
new file mode 100644
index 0000000..91440bf
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/009-div-assign.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  int fooInt;
+
+  fooInt /= undefined;
+  fooInt /= defined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/009-div-assign.vert.expected b/src/compiler/glsl/tests/warnings/009-div-assign.vert.expected
new file mode 100644
index 0000000..8fbb408
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/009-div-assign.vert.expected
@@ -0,0 +1 @@
+0:9(12): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/010-add-assign.vert b/src/compiler/glsl/tests/warnings/010-add-assign.vert
new file mode 100644
index 0000000..661219f
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/010-add-assign.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  int fooInt;
+
+  fooInt += undefined;
+  fooInt += defined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/010-add-assign.vert.expected b/src/compiler/glsl/tests/warnings/010-add-assign.vert.expected
new file mode 100644
index 0000000..8fbb408
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/010-add-assign.vert.expected
@@ -0,0 +1 @@
+0:9(12): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/011-sub-assign.vert b/src/compiler/glsl/tests/warnings/011-sub-assign.vert
new file mode 100644
index 0000000..9839dec
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/011-sub-assign.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  int fooInt;
+
+  fooInt -= undefined;
+  fooInt -= defined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/011-sub-assign.vert.expected b/src/compiler/glsl/tests/warnings/011-sub-assign.vert.expected
new file mode 100644
index 0000000..8fbb408
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/011-sub-assign.vert.expected
@@ -0,0 +1 @@
+0:9(12): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/012-modassign.vert b/src/compiler/glsl/tests/warnings/012-modassign.vert
new file mode 100644
index 0000000..2f261a3
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/012-modassign.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  int myInt;
+
+  myInt %= undefined;
+  myInt %= defined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/012-modassign.vert.expected b/src/compiler/glsl/tests/warnings/012-modassign.vert.expected
new file mode 100644
index 0000000..637142e
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/012-modassign.vert.expected
@@ -0,0 +1 @@
+0:9(11): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/013-lsassign.vert b/src/compiler/glsl/tests/warnings/013-lsassign.vert
new file mode 100644
index 0000000..f2b49e2
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/013-lsassign.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  int fooInt;
+
+  fooInt >>= undefined;
+  fooInt >>= defined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/013-lsassign.vert.expected b/src/compiler/glsl/tests/warnings/013-lsassign.vert.expected
new file mode 100644
index 0000000..b20d3c0
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/013-lsassign.vert.expected
@@ -0,0 +1 @@
+0:9(13): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/014-rsassign.vert b/src/compiler/glsl/tests/warnings/014-rsassign.vert
new file mode 100644
index 0000000..798b6cc
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/014-rsassign.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  int fooInt;
+
+  fooInt <<= undefined;
+  fooInt <<= defined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/014-rsassign.vert.expected b/src/compiler/glsl/tests/warnings/014-rsassign.vert.expected
new file mode 100644
index 0000000..b20d3c0
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/014-rsassign.vert.expected
@@ -0,0 +1 @@
+0:9(13): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/015-andassign.vert b/src/compiler/glsl/tests/warnings/015-andassign.vert
new file mode 100644
index 0000000..a86a8d8
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/015-andassign.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  int fooInt;
+
+  fooInt &= undefined;
+  fooInt &= defined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/015-andassign.vert.expected b/src/compiler/glsl/tests/warnings/015-andassign.vert.expected
new file mode 100644
index 0000000..8fbb408
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/015-andassign.vert.expected
@@ -0,0 +1 @@
+0:9(12): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/016-orassign.vert b/src/compiler/glsl/tests/warnings/016-orassign.vert
new file mode 100644
index 0000000..c04241a
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/016-orassign.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  int fooInt;
+
+  fooInt |= undefined;
+  fooInt |= defined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/016-orassign.vert.expected b/src/compiler/glsl/tests/warnings/016-orassign.vert.expected
new file mode 100644
index 0000000..8fbb408
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/016-orassign.vert.expected
@@ -0,0 +1 @@
+0:9(12): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/017-xorassign.vert b/src/compiler/glsl/tests/warnings/017-xorassign.vert
new file mode 100644
index 0000000..ff649f7
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/017-xorassign.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  int fooInt;
+
+  fooInt ^= undefined;
+  fooInt ^= defined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/017-xorassign.vert.expected b/src/compiler/glsl/tests/warnings/017-xorassign.vert.expected
new file mode 100644
index 0000000..8fbb408
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/017-xorassign.vert.expected
@@ -0,0 +1 @@
+0:9(12): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/018-bitand.vert b/src/compiler/glsl/tests/warnings/018-bitand.vert
new file mode 100644
index 0000000..7e879dc
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/018-bitand.vert
@@ -0,0 +1,24 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  float fooFloat;
+
+  if ((undefined | 2) == 0) {
+    fooFloat = 10.0;
+  }
+
+  if ((defined | 2) == 0) {
+    fooFloat = 10.0;
+  }
+
+  if ((undefined | defined) == 0) {
+    fooFloat = 10.0;
+  }
+
+  if ((defined | undefined) == 0) {
+    fooFloat = 10.0;
+  }
+}
diff --git a/src/compiler/glsl/tests/warnings/018-bitand.vert.expected b/src/compiler/glsl/tests/warnings/018-bitand.vert.expected
new file mode 100644
index 0000000..c7e5c99
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/018-bitand.vert.expected
@@ -0,0 +1,3 @@
+0:9(7): warning: `undefined' used uninitialized
+0:17(7): warning: `undefined' used uninitialized
+0:21(17): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/019-array.vert b/src/compiler/glsl/tests/warnings/019-array.vert
new file mode 100644
index 0000000..43d7f4c
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/019-array.vert
@@ -0,0 +1,23 @@
+#version 130
+
+void main()
+{
+  int undefinedIndex;
+  int undefinedIndex2;
+  int definedIndex = 2;
+  int definedIndex2 = 2;
+  float array[4];
+  float fooPos;
+  int fooLength;
+
+  fooPos = array[undefinedIndex];
+  fooPos = array[definedIndex];
+
+  fooPos = array[definedIndex+definedIndex2];
+  fooPos = array[undefinedIndex+undefinedIndex2];
+  array[0] = 10.0;
+  fooPos = array[definedIndex];
+
+  array[undefinedIndex2] = array[undefinedIndex];
+}
+
diff --git a/src/compiler/glsl/tests/warnings/019-array.vert.expected b/src/compiler/glsl/tests/warnings/019-array.vert.expected
new file mode 100644
index 0000000..3d80306
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/019-array.vert.expected
@@ -0,0 +1,5 @@
+0:13(17): warning: `undefinedIndex' used uninitialized
+0:17(17): warning: `undefinedIndex' used uninitialized
+0:17(32): warning: `undefinedIndex2' used uninitialized
+0:21(8): warning: `undefinedIndex2' used uninitialized
+0:21(33): warning: `undefinedIndex' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/020-array-length.vert b/src/compiler/glsl/tests/warnings/020-array-length.vert
new file mode 100644
index 0000000..0fa57b2
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/020-array-length.vert
@@ -0,0 +1,12 @@
+#version 130
+
+void main()
+{
+  float array[4];
+  int fooLength;
+
+  fooLength = array.length();
+  array[0] = 2.0;
+  fooLength = array.length();
+}
+
diff --git a/src/compiler/glsl/tests/warnings/020-array-length.vert.expected b/src/compiler/glsl/tests/warnings/020-array-length.vert.expected
new file mode 100644
index 0000000..e69de29
diff --git a/src/compiler/glsl/tests/warnings/021-lshift.vert b/src/compiler/glsl/tests/warnings/021-lshift.vert
new file mode 100644
index 0000000..ed8c819
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/021-lshift.vert
@@ -0,0 +1,25 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  float fooFloat;
+
+  if (undefined << 2 == 0) {
+    fooFloat = 10.0;
+  }
+
+  if (defined << 2 == 0) {
+    fooFloat = 10.0;
+  }
+
+  if (undefined << defined == 0) {
+    fooFloat = 10.0;
+  }
+
+  if (defined << undefined == 0) {
+    fooFloat = 10.0;
+  }
+}
+
diff --git a/src/compiler/glsl/tests/warnings/021-lshift.vert.expected b/src/compiler/glsl/tests/warnings/021-lshift.vert.expected
new file mode 100644
index 0000000..5813f12
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/021-lshift.vert.expected
@@ -0,0 +1,3 @@
+0:9(6): warning: `undefined' used uninitialized
+0:17(6): warning: `undefined' used uninitialized
+0:21(17): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/022-rshift.vert b/src/compiler/glsl/tests/warnings/022-rshift.vert
new file mode 100644
index 0000000..226d346
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/022-rshift.vert
@@ -0,0 +1,25 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  float fooFloat;
+
+  if (undefined >> 2 == 0) {
+    fooFloat = 10.0;
+  }
+
+  if (defined >> 2 == 0) {
+    fooFloat = 10.0;
+  }
+
+  if (undefined >> defined == 0) {
+    fooFloat = 10.0;
+  }
+
+  if (defined >> undefined == 0) {
+    fooFloat = 10.0;
+  }
+}
+
diff --git a/src/compiler/glsl/tests/warnings/022-rshift.vert.expected b/src/compiler/glsl/tests/warnings/022-rshift.vert.expected
new file mode 100644
index 0000000..5813f12
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/022-rshift.vert.expected
@@ -0,0 +1,3 @@
+0:9(6): warning: `undefined' used uninitialized
+0:17(6): warning: `undefined' used uninitialized
+0:21(17): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/023-switch.vert b/src/compiler/glsl/tests/warnings/023-switch.vert
new file mode 100644
index 0000000..4527971
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/023-switch.vert
@@ -0,0 +1,28 @@
+#version 130
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  float fooFloat;
+  int fooInt;
+
+  switch(undefined) {
+  case 0:
+    fooFloat = 0.0;
+  case 1:
+    fooFloat = 1.0;
+  default:
+    fooFloat = undefined;
+  }
+
+  switch(defined) {
+  case 0:
+    fooFloat = 0.0;
+  case 1:
+    fooFloat = 1.0;
+  default:
+    fooFloat = undefined;
+  }
+}
+
diff --git a/src/compiler/glsl/tests/warnings/023-switch.vert.expected b/src/compiler/glsl/tests/warnings/023-switch.vert.expected
new file mode 100644
index 0000000..201d0a2
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/023-switch.vert.expected
@@ -0,0 +1,3 @@
+0:10(9): warning: `undefined' used uninitialized
+0:16(13): warning: `undefined' used uninitialized
+0:25(13): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/024-shaderout.vert b/src/compiler/glsl/tests/warnings/024-shaderout.vert
new file mode 100644
index 0000000..00a7988
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/024-shaderout.vert
@@ -0,0 +1,19 @@
+#version 130
+
+out int fooOut;
+
+void main()
+{
+  int defined = 2;
+  int undefined;
+  int fooInt;
+
+  defined = fooOut;
+  fooOut = undefined;
+  /* Technically at this point fooOut is still undefined. But it was
+   * initialized that is what the unitialized warning detects in any
+   * case. "Real undefined" is beyond the scope of what mesa is/should
+   * detect*/
+  defined = fooOut;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/024-shaderout.vert.expected b/src/compiler/glsl/tests/warnings/024-shaderout.vert.expected
new file mode 100644
index 0000000..c85c55a
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/024-shaderout.vert.expected
@@ -0,0 +1,2 @@
+0:11(12): warning: `fooOut' used uninitialized
+0:12(11): warning: `undefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/025-out-inout-function-parameters.vert b/src/compiler/glsl/tests/warnings/025-out-inout-function-parameters.vert
new file mode 100644
index 0000000..c6b2b16
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/025-out-inout-function-parameters.vert
@@ -0,0 +1,16 @@
+#version 130
+
+void foo(float normalVar, out float outVar, inout float inoutVar)
+{
+  outVar = 1.0f;
+}
+
+void main()
+{
+   float undefinedFloat;
+   float noRaise;
+   float noRaise2;
+
+   foo(undefinedFloat, noRaise, noRaise2);
+}
+
diff --git a/src/compiler/glsl/tests/warnings/025-out-inout-function-parameters.vert.expected b/src/compiler/glsl/tests/warnings/025-out-inout-function-parameters.vert.expected
new file mode 100644
index 0000000..5e2c007
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/025-out-inout-function-parameters.vert.expected
@@ -0,0 +1 @@
+0:14(6): warning: `undefinedFloat' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/026-conditional.vert b/src/compiler/glsl/tests/warnings/026-conditional.vert
new file mode 100644
index 0000000..3447f05
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/026-conditional.vert
@@ -0,0 +1,17 @@
+#version 130
+
+void main()
+{
+  bool defined = false;
+  bool undefined;
+  int fooInt;
+  int definedInt = 2;
+  int undefinedInt;
+
+  fooInt = defined ? definedInt : undefinedInt;
+  fooInt = defined ? undefinedInt : definedInt;
+
+  fooInt = undefined ? definedInt : undefinedInt;
+  fooInt = undefined ? undefinedInt : definedInt;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/026-conditional.vert.expected b/src/compiler/glsl/tests/warnings/026-conditional.vert.expected
new file mode 100644
index 0000000..aaf5b7b
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/026-conditional.vert.expected
@@ -0,0 +1,6 @@
+0:11(34): warning: `undefinedInt' used uninitialized
+0:12(21): warning: `undefinedInt' used uninitialized
+0:14(11): warning: `undefined' used uninitialized
+0:14(36): warning: `undefinedInt' used uninitialized
+0:15(11): warning: `undefined' used uninitialized
+0:15(23): warning: `undefinedInt' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/027-fieldselection.vert b/src/compiler/glsl/tests/warnings/027-fieldselection.vert
new file mode 100644
index 0000000..cdec06a
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/027-fieldselection.vert
@@ -0,0 +1,23 @@
+#version 130
+
+struct s {
+  float c;
+  float x;
+};
+
+void main()
+{
+  float fooFloat;
+  s fooStruct;
+
+  fooFloat = fooStruct.c;
+  fooStruct.c = 10.0;
+  fooFloat = fooStruct.c;
+  fooStruct.c = 20.0;
+
+  /* Technically .x is also uninitialized, but detecting this is beyond
+   * scope. FWIW, gcc doesn't detect this neither.
+   */
+  fooFloat = fooStruct.x;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/027-fieldselection.vert.expected b/src/compiler/glsl/tests/warnings/027-fieldselection.vert.expected
new file mode 100644
index 0000000..0a2c04a
--- /dev/null
+++ b/src/compiler/glsl/tests/warnings/027-fieldselection.vert.expected
@@ -0,0 +1 @@
+0:13(13): warning: `fooStruct' used uninitialized
-- 
2.7.4



More information about the mesa-dev mailing list