diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-05-31 15:00:49 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-08-09 16:06:18 +0200 |
| commit | 6ed98066f6d184f2f0f918570aaa6a1934668ac2 (patch) | |
| tree | 37df8e0fa77c972a6ab8528e18df5b64d86e204d /validation/linear | |
| parent | 13252024246cc03fc8cc0d812c61421f96faa3c7 (diff) | |
| download | sparse-dev-6ed98066f6d184f2f0f918570aaa6a1934668ac2.tar.gz | |
force to 0 expressions which are erroneously non-constant
When an expression that needs to be constant but is, in fact,
not constant, sparse throws an error and leaves it as-is.
But some code makes the assumption that the expression is
constant and uses its value, with some random result.
One situation where this happens is in code like:
switch (x) {
case <some non-const expression>: ...
In this case, the linearization of the switch/case statement
will unconditionally use the value of the case expression
but the expression has no value.
One way to avoid this would be to add defensive checks each
time a value is retrieved but this is a lot of work and time
for no benefits.
So, change this by forcing the expression to be a constant
value of 0 just after the error message has been issued.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/linear')
0 files changed, 0 insertions, 0 deletions
