glsl: add unit tests data vertex/expected outcome for uninitialized warning
authorAlejandro Piñeiro <apinheiro@igalia.com>
Wed, 20 Apr 2016 08:02:45 +0000 (10:02 +0200)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Thu, 26 May 2016 07:19:36 +0000 (09:19 +0200)
v2: fix 025 test. Add three more tests (Ian Romanick)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
62 files changed:
src/compiler/glsl/tests/warnings/000-basic-test.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/000-basic-test.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/001-use-undefined-then-define.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/002-loop.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/002-loop.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/003-less.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/003-less.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/004-greater.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/004-greater.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/005-lequal.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/005-lequal.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/006-gequal.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/006-gequal.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/007-test-mod.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/007-test-mod.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/008-mulassign.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/008-mulassign.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/009-div-assign.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/009-div-assign.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/010-add-assign.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/010-add-assign.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/011-sub-assign.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/011-sub-assign.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/012-modassign.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/012-modassign.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/013-lsassign.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/013-lsassign.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/014-rsassign.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/014-rsassign.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/015-andassign.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/015-andassign.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/016-orassign.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/016-orassign.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/017-xorassign.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/017-xorassign.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/018-bitand.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/018-bitand.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/019-array.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/019-array.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/020-array-length.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/020-array-length.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/021-lshift.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/021-lshift.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/022-rshift.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/022-rshift.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/023-switch.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/023-switch.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/024-shaderout.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/024-shaderout.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/025-function-parameters.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/025-function-parameters.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/026-out-function-parameter-shaderout.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/026-out-function-parameter-shaderout.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/027-inout-function-parameter-shaderout.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/027-inout-function-parameter-shaderout.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/028-conditional.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/028-conditional.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/029-fieldselection.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/029-fieldselection.vert.expected [new file with mode: 0644]
src/compiler/glsl/tests/warnings/030-array-as-function-parameter.vert [new file with mode: 0644]
src/compiler/glsl/tests/warnings/030-array-as-function-parameter.vert.expected [new file with mode: 0644]

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 (file)
index 0000000..266eed6
--- /dev/null
@@ -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 (file)
index 0000000..ed02a95
--- /dev/null
@@ -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 (file)
index 0000000..2175afe
--- /dev/null
@@ -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 (file)
index 0000000..a036d67
--- /dev/null
@@ -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 (file)
index 0000000..de05d9c
--- /dev/null
@@ -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 (file)
index 0000000..7a51001
--- /dev/null
@@ -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 (file)
index 0000000..bbab55a
--- /dev/null
@@ -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 (file)
index 0000000..93cd789
--- /dev/null
@@ -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 (file)
index 0000000..c9842e5
--- /dev/null
@@ -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 (file)
index 0000000..93cd789
--- /dev/null
@@ -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 (file)
index 0000000..73e476a
--- /dev/null
@@ -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 (file)
index 0000000..93cd789
--- /dev/null
@@ -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 (file)
index 0000000..f1694bd
--- /dev/null
@@ -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 (file)
index 0000000..93cd789
--- /dev/null
@@ -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 (file)
index 0000000..2881db8
--- /dev/null
@@ -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 (file)
index 0000000..78613d5
--- /dev/null
@@ -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 (file)
index 0000000..0923891
--- /dev/null
@@ -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 (file)
index 0000000..8fbb408
--- /dev/null
@@ -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 (file)
index 0000000..91440bf
--- /dev/null
@@ -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 (file)
index 0000000..8fbb408
--- /dev/null
@@ -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 (file)
index 0000000..661219f
--- /dev/null
@@ -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 (file)
index 0000000..8fbb408
--- /dev/null
@@ -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 (file)
index 0000000..9839dec
--- /dev/null
@@ -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 (file)
index 0000000..8fbb408
--- /dev/null
@@ -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 (file)
index 0000000..2f261a3
--- /dev/null
@@ -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 (file)
index 0000000..637142e
--- /dev/null
@@ -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 (file)
index 0000000..f2b49e2
--- /dev/null
@@ -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 (file)
index 0000000..b20d3c0
--- /dev/null
@@ -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 (file)
index 0000000..798b6cc
--- /dev/null
@@ -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 (file)
index 0000000..b20d3c0
--- /dev/null
@@ -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 (file)
index 0000000..a86a8d8
--- /dev/null
@@ -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 (file)
index 0000000..8fbb408
--- /dev/null
@@ -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 (file)
index 0000000..c04241a
--- /dev/null
@@ -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 (file)
index 0000000..8fbb408
--- /dev/null
@@ -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 (file)
index 0000000..ff649f7
--- /dev/null
@@ -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 (file)
index 0000000..8fbb408
--- /dev/null
@@ -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 (file)
index 0000000..7e879dc
--- /dev/null
@@ -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 (file)
index 0000000..c7e5c99
--- /dev/null
@@ -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 (file)
index 0000000..43d7f4c
--- /dev/null
@@ -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 (file)
index 0000000..3d80306
--- /dev/null
@@ -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 (file)
index 0000000..0fa57b2
--- /dev/null
@@ -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 (file)
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 (file)
index 0000000..ed8c819
--- /dev/null
@@ -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 (file)
index 0000000..5813f12
--- /dev/null
@@ -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 (file)
index 0000000..226d346
--- /dev/null
@@ -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 (file)
index 0000000..5813f12
--- /dev/null
@@ -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 (file)
index 0000000..4527971
--- /dev/null
@@ -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 (file)
index 0000000..201d0a2
--- /dev/null
@@ -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 (file)
index 0000000..00a7988
--- /dev/null
@@ -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 (file)
index 0000000..c85c55a
--- /dev/null
@@ -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-function-parameters.vert b/src/compiler/glsl/tests/warnings/025-function-parameters.vert
new file mode 100644 (file)
index 0000000..0b7f7e5
--- /dev/null
@@ -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 undefinedFloat2;
+
+   foo(undefinedFloat, noRaise, undefinedFloat2);
+}
+
diff --git a/src/compiler/glsl/tests/warnings/025-function-parameters.vert.expected b/src/compiler/glsl/tests/warnings/025-function-parameters.vert.expected
new file mode 100644 (file)
index 0000000..eb06585
--- /dev/null
@@ -0,0 +1,2 @@
+0:14(6): warning: `undefinedFloat' used uninitialized
+0:14(31): warning: `undefinedFloat2' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/026-out-function-parameter-shaderout.vert b/src/compiler/glsl/tests/warnings/026-out-function-parameter-shaderout.vert
new file mode 100644 (file)
index 0000000..4d7a44f
--- /dev/null
@@ -0,0 +1,14 @@
+#version 130
+
+void fooFunction(out float outVar);
+
+out float fooOut;
+
+void main()
+{
+   float willBeDefined;
+
+   fooFunction(willBeDefined);
+   fooOut = willBeDefined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/026-out-function-parameter-shaderout.vert.expected b/src/compiler/glsl/tests/warnings/026-out-function-parameter-shaderout.vert.expected
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/compiler/glsl/tests/warnings/027-inout-function-parameter-shaderout.vert b/src/compiler/glsl/tests/warnings/027-inout-function-parameter-shaderout.vert
new file mode 100644 (file)
index 0000000..57ca755
--- /dev/null
@@ -0,0 +1,14 @@
+#version 130
+
+void fooFunction(inout float outVar);
+
+out float fooOut;
+
+void main()
+{
+   float willBeDefined;
+
+   fooFunction(willBeDefined);
+   fooOut = willBeDefined;
+}
+
diff --git a/src/compiler/glsl/tests/warnings/027-inout-function-parameter-shaderout.vert.expected b/src/compiler/glsl/tests/warnings/027-inout-function-parameter-shaderout.vert.expected
new file mode 100644 (file)
index 0000000..1724975
--- /dev/null
@@ -0,0 +1 @@
+0:11(14): warning: `willBeDefined' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/028-conditional.vert b/src/compiler/glsl/tests/warnings/028-conditional.vert
new file mode 100644 (file)
index 0000000..3447f05
--- /dev/null
@@ -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/028-conditional.vert.expected b/src/compiler/glsl/tests/warnings/028-conditional.vert.expected
new file mode 100644 (file)
index 0000000..aaf5b7b
--- /dev/null
@@ -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/029-fieldselection.vert b/src/compiler/glsl/tests/warnings/029-fieldselection.vert
new file mode 100644 (file)
index 0000000..cdec06a
--- /dev/null
@@ -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/029-fieldselection.vert.expected b/src/compiler/glsl/tests/warnings/029-fieldselection.vert.expected
new file mode 100644 (file)
index 0000000..0a2c04a
--- /dev/null
@@ -0,0 +1 @@
+0:13(13): warning: `fooStruct' used uninitialized
diff --git a/src/compiler/glsl/tests/warnings/030-array-as-function-parameter.vert b/src/compiler/glsl/tests/warnings/030-array-as-function-parameter.vert
new file mode 100644 (file)
index 0000000..8689f07
--- /dev/null
@@ -0,0 +1,17 @@
+#version 130
+
+void foo(float normalVar, out float outVar, inout float inoutVar);
+
+void main()
+{
+   int undefinedIndex;
+   int definedIndex = 2;
+   float willBeDefined[4];
+
+   foo(willBeDefined[undefinedIndex], willBeDefined[undefinedIndex], willBeDefined[undefinedIndex]);
+   foo(willBeDefined[definedIndex], willBeDefined[definedIndex], willBeDefined[definedIndex]);
+   willBeDefined[0] = 10.0;
+   foo(willBeDefined[undefinedIndex], willBeDefined[undefinedIndex], willBeDefined[undefinedIndex]);
+   foo(willBeDefined[definedIndex], willBeDefined[definedIndex], willBeDefined[definedIndex]);
+}
+
diff --git a/src/compiler/glsl/tests/warnings/030-array-as-function-parameter.vert.expected b/src/compiler/glsl/tests/warnings/030-array-as-function-parameter.vert.expected
new file mode 100644 (file)
index 0000000..21cb2c5
--- /dev/null
@@ -0,0 +1,7 @@
+0:11(20): warning: `undefinedIndex' used uninitialized
+0:11(51): warning: `undefinedIndex' used uninitialized
+0:11(82): warning: `undefinedIndex' used uninitialized
+0:11(6): warning: `willBeDefined' used uninitialized
+0:14(20): warning: `undefinedIndex' used uninitialized
+0:14(51): warning: `undefinedIndex' used uninitialized
+0:14(82): warning: `undefinedIndex' used uninitialized