skia2/tests/sksl/errors/golden/ArrayIndexOutOfRange.glsl
John Stiles 12739dffec Handle values above int32 safely during IR generation.
Previously, SKSL_INT was limited to an int32_t, so we couldn't
differentiate between -1 and 4294967295. We could paper over the
difference in some cases by relying on the expression's type, but this
was imperfect and left us unable to differentiate between an overflow
and valid results. SKSL_INT is now an int64_t; the code has been
updated to fix bugs that shook out as a result of the change.

This isn't a complete solution for overflow handling. There are still
lots of obvious places for improvement--e.g. constant folding can
easily overflow, and statements like `byte x = 1000;` are still
happily accepted.

Change-Id: I30d1f56b6f264543f3aa83046f43c2eb56d5fce4
Bug: skia:10932
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345173
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-12-29 16:26:56 +00:00

34 lines
1.5 KiB
GLSL

### Compilation failed:
error: 3: index -1 out of range for 'int[123]'
error: 6: index 123 out of range for 'half4x4[123]'
error: 7: index 1000000000 out of range for 'int4[123]'
error: 8: index 3000000000 out of range for 'half3[123]'
error: 10: index -1 out of range for 'Block[]'
error: 13: index 3000000000 out of range for 'Block[]'
error: 15: index -1 out of range for 'half4'
error: 20: index 4 out of range for 'half4'
error: 21: index 1000000000 out of range for 'half4'
error: 23: index -1 out of range for 'half3'
error: 27: index 3 out of range for 'half3'
error: 28: index 4 out of range for 'half3'
error: 29: index 1000000000 out of range for 'half3'
error: 31: index -1 out of range for 'half2'
error: 34: index 2 out of range for 'half2'
error: 35: index 3 out of range for 'half2'
error: 36: index 4 out of range for 'half2'
error: 37: index 1000000000 out of range for 'half2'
error: 39: index -1 out of range for 'half2x4'
error: 42: index 2 out of range for 'half2x4'
error: 43: index 3 out of range for 'half2x4'
error: 44: index 4 out of range for 'half2x4'
error: 45: index 1000000000 out of range for 'half2x4'
error: 47: index -1 out of range for 'half3x3'
error: 51: index 3 out of range for 'half3x3'
error: 52: index 4 out of range for 'half3x3'
error: 53: index 1000000000 out of range for 'half3x3'
error: 55: index -1 out of range for 'half4x2'
error: 60: index 4 out of range for 'half4x2'
error: 61: index 1000000000 out of range for 'half4x2'
30 errors