aa369d2b8e
It's possible to write code containing errors that are only apparent once the inliner runs. For instance, a function which takes a short and returns its negative it is valid for most inputs, but undefined for -32768 (because +32768 does not fit in a short). A function which takes floats and casts them to ints is valid for many inputs, but not valid if you pass in 5 billion. This CL restructures our out-of-range integer error detection to report errors cleanly in these cases instead of asserting. It also refactors the range checking code to be usable in situations where we don't yet have a Literal expression. Change-Id: I98f0be63bf9afbbf1ab90233fa86d380cfae42b4 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466439 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
10 lines
397 B
GLSL
10 lines
397 B
GLSL
### Compilation failed:
|
|
|
|
error: 20: integer is out of range for type 'short': 99999
|
|
error: 21: integer is out of range for type 'short': 67890
|
|
error: 22: integer is out of range for type 'int': 5000000000
|
|
error: 23: integer is out of range for type 'int': 3000000000
|
|
error: 24: integer is out of range for type 'short': 32768
|
|
error: 25: integer is out of range for type 'int': 2147483648
|
|
6 errors
|