diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-27 14:42:31 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-09-01 08:43:40 +0200 |
| commit | a5a8f8b9a1febfbae59751d1ce25a86ada8818ae (patch) | |
| tree | 76ba1e448a2858fc8939e3b9400ecc5497812185 /validation/linear | |
| parent | 86556e1537cb094ddd33e30d1ee451d8930246c6 (diff) | |
| download | sparse-dev-a5a8f8b9a1febfbae59751d1ce25a86ada8818ae.tar.gz | |
fix linearization of unreachable switch (with reachable label).
An unreachable/inactive switch statement is currently not
linearized. That's nice because it avoids to create useless
instructions.
However, the body of the statement can contain a label which
can be reachable. If so, the resulting IR will contain a branch
to an unexisting BB. Bad.
For example, code like:
int foo(int a)
{
goto label;
switch(a) {
default:
label:
break;
}
return 0;
}
(which is just a complicated way to write: int foo(int a) { return 0; })
is linearized as:
foo:
br .L1
Fix this by linearizing the statement even if not active.
Note: it seems that none of the other statements are discarded
if inactive. Good. OTOH, statement expressions can also
contains (reachable) labels and thus would need the same
fix (which will need much more work).
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/linear')
| -rw-r--r-- | validation/linear/unreachable-label0.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/validation/linear/unreachable-label0.c b/validation/linear/unreachable-label0.c index 568ae588..695e5cb0 100644 --- a/validation/linear/unreachable-label0.c +++ b/validation/linear/unreachable-label0.c @@ -12,7 +12,6 @@ label: /* * check-name: unreachable-label0 * check-command: test-linearize $file - * check-known-to-fail * * check-output-ignore * check-output-contains: ret\\. |
