diff options
author | Alejandro Piñeiro <[email protected]> | 2016-04-20 10:02:45 +0200 |
---|---|---|
committer | Alejandro Piñeiro <[email protected]> | 2016-05-26 09:19:36 +0200 |
commit | 2ed9563e79670ba2430f0827050e9a851fc56e79 (patch) | |
tree | 8a5c675d3671301f84d30bc5c74c4ae118a3f68e /src/compiler/glsl | |
parent | eee00274fa330edfa536da039ba9116bdceb9990 (diff) |
glsl: add unit tests data vertex/expected outcome for uninitialized warning
v2: fix 025 test. Add three more tests (Ian Romanick)
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
62 files changed, 573 insertions, 0 deletions
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 00000000000..266eed6402b --- /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 00000000000..ed02a957d70 --- /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 00000000000..2175afe066c --- /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 00000000000..a036d67e2d7 --- /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 00000000000..de05d9c722b --- /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 00000000000..7a510018e12 --- /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 00000000000..bbab55a0419 --- /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 00000000000..93cd7896c0a --- /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 00000000000..c9842e597bf --- /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 00000000000..93cd7896c0a --- /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 00000000000..73e476a1eb6 --- /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 00000000000..93cd7896c0a --- /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 00000000000..f1694bd382d --- /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 00000000000..93cd7896c0a --- /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 00000000000..2881db84a77 --- /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 00000000000..78613d54ca2 --- /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 00000000000..092389153ef --- /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 00000000000..8fbb408dd97 --- /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 00000000000..91440bf8ebf --- /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 00000000000..8fbb408dd97 --- /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 00000000000..661219f5151 --- /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 00000000000..8fbb408dd97 --- /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 00000000000..9839decbe34 --- /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 00000000000..8fbb408dd97 --- /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 00000000000..2f261a32fdb --- /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 00000000000..637142e9425 --- /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 00000000000..f2b49e2e409 --- /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 00000000000..b20d3c0746d --- /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 00000000000..798b6cc4c42 --- /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 00000000000..b20d3c0746d --- /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 00000000000..a86a8d88d74 --- /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 00000000000..8fbb408dd97 --- /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 00000000000..c04241a603a --- /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 00000000000..8fbb408dd97 --- /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 00000000000..ff649f793f4 --- /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 00000000000..8fbb408dd97 --- /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 00000000000..7e879dc99e1 --- /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 00000000000..c7e5c994f5d --- /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 00000000000..43d7f4c0399 --- /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 00000000000..3d80306ad0b --- /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 00000000000..0fa57b22dd8 --- /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 00000000000..e69de29bb2d --- /dev/null +++ b/src/compiler/glsl/tests/warnings/020-array-length.vert.expected 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 00000000000..ed8c819bcbf --- /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 00000000000..5813f12a0c6 --- /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 00000000000..226d3466b06 --- /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 00000000000..5813f12a0c6 --- /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 00000000000..45279710fe8 --- /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 00000000000..201d0a2238e --- /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 00000000000..00a7988276e --- /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 00000000000..c85c55a36b1 --- /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-function-parameters.vert b/src/compiler/glsl/tests/warnings/025-function-parameters.vert new file mode 100644 index 00000000000..0b7f7e5b182 --- /dev/null +++ b/src/compiler/glsl/tests/warnings/025-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 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 index 00000000000..eb0658514e2 --- /dev/null +++ b/src/compiler/glsl/tests/warnings/025-function-parameters.vert.expected @@ -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 index 00000000000..4d7a44f9af4 --- /dev/null +++ b/src/compiler/glsl/tests/warnings/026-out-function-parameter-shaderout.vert @@ -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 index 00000000000..e69de29bb2d --- /dev/null +++ b/src/compiler/glsl/tests/warnings/026-out-function-parameter-shaderout.vert.expected 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 index 00000000000..57ca755be3d --- /dev/null +++ b/src/compiler/glsl/tests/warnings/027-inout-function-parameter-shaderout.vert @@ -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 index 00000000000..17249752d22 --- /dev/null +++ b/src/compiler/glsl/tests/warnings/027-inout-function-parameter-shaderout.vert.expected @@ -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 index 00000000000..3447f05c7da --- /dev/null +++ b/src/compiler/glsl/tests/warnings/028-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/028-conditional.vert.expected b/src/compiler/glsl/tests/warnings/028-conditional.vert.expected new file mode 100644 index 00000000000..aaf5b7bd219 --- /dev/null +++ b/src/compiler/glsl/tests/warnings/028-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/029-fieldselection.vert b/src/compiler/glsl/tests/warnings/029-fieldselection.vert new file mode 100644 index 00000000000..cdec06aed44 --- /dev/null +++ b/src/compiler/glsl/tests/warnings/029-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/029-fieldselection.vert.expected b/src/compiler/glsl/tests/warnings/029-fieldselection.vert.expected new file mode 100644 index 00000000000..0a2c04ad802 --- /dev/null +++ b/src/compiler/glsl/tests/warnings/029-fieldselection.vert.expected @@ -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 index 00000000000..8689f07fb42 --- /dev/null +++ b/src/compiler/glsl/tests/warnings/030-array-as-function-parameter.vert @@ -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 index 00000000000..21cb2c5a2c8 --- /dev/null +++ b/src/compiler/glsl/tests/warnings/030-array-as-function-parameter.vert.expected @@ -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 |