diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-09-06 13:26:39 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-09-08 16:53:25 +0200 |
| commit | 78ce37356fd090e5353bc61031de1c8e717d24f6 (patch) | |
| tree | f72f589145fb645209a7b710567f1c22f3a846d6 /validation | |
| parent | f43d375657f22cf69668a417f555fcc7a0a780d5 (diff) | |
| download | sparse-dev-78ce37356fd090e5353bc61031de1c8e717d24f6.tar.gz | |
fix linearization of non-constant switch-cases
The linearization of switches & cases makes the assumption
that the expressions for the cases are constants (EXPR_VALUE).
So, the corresponding values are dereferenced without checks.
However, if the code uses a non-constant case, this dereference
produces a random value, probably one corresponding to some
pointers belonging to the real type of the expression.
Fix this by checking during linearization the constness of the
expression and ignore the non-constant ones.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/linear/non-const-case.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/validation/linear/non-const-case.c b/validation/linear/non-const-case.c index 5cf55717..7291589c 100644 --- a/validation/linear/non-const-case.c +++ b/validation/linear/non-const-case.c @@ -30,7 +30,6 @@ label: /* * check-name: non-const-case * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-error-ignore * check-output-ignore |
