skia2/tests/sksl/errors/OverflowIntLiteral.glsl
John Stiles b0d93ccc90 Detect out-of-range integer assignment.
Now that we know the minimum and maximum values of a given integer Type,
we can check for assigment statements or variable initial-values that
exceed those bounds and report it as an error. This check should work on
anything that can be optimized or folded down to an IntLiteral, but
isn't meant to be 100% exhaustive.

Change-Id: I4473b5b003e1b8e3385943ce60e303e95664e8ba
Bug: skia:10932
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413437
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-06-01 15:53:43 +00:00

14 lines
653 B
GLSL

### Compilation failed:
error: 4: integer is out of range for type 'int': -2147483649
error: 6: integer is out of range for type 'int': 2147483648
error: 9: integer is out of range for type 'ushort4': -1
error: 9: integer is out of range for type 'ushort4': 65536
error: 14: integer is out of range for type 'short4': -32769
error: 14: integer is out of range for type 'short4': 32768
error: 19: integer is out of range for type 'int4': -2147483649
error: 19: integer is out of range for type 'int4': 2147483648
error: 24: integer is out of range for type 'uint4': -2147483648
error: 24: integer is out of range for type 'uint4': -2147483649
10 errors