Wrong testcase for sheet 4 task 1
Moderator: Implementing code analyses for large software systems
Wrong testcase for sheet 4 task 1
When implementing task 1 a), we came to the conclusion that the testcase for TargetClass2 is incorrect. As in the TargetClass1 testcase, the branch parameter is asserted to be false. This would mean the code is actually alive (as the branch condition is inverted), which is correct in TargetClass1 (as 3,4,5 is a pythagoras triple), but wrong for TargetClass2 (as v = 0).
-
- Erstie
- Beiträge: 11
- Registriert: 30. Okt 2014 13:29
Re: Wrong testcase for sheet 4 task 1
Hi,
speaking of the Java source code, you are right.
But as we analyze Jimple, the reporting is also based on the Jimple code, where the conditions are somewhat different!
So have a look into the Jimple code, what needs to be reported. I hope it helps!
Johannes
speaking of the Java source code, you are right.
But as we analyze Jimple, the reporting is also based on the Jimple code, where the conditions are somewhat different!
So have a look into the Jimple code, what needs to be reported. I hope it helps!
Johannes
Re: Wrong testcase for sheet 4 task 1
That's exactly what we did:
The jimple code of the branch in TargetClass1 is. As h = 25 and b = 25, this branch is never taken.
The jimple code of the branch in TargetClass2 is. Now, v = 0, so $b0 is 0, too. This branch therefore is always taken. We therefore have to report differently to the first test, but the testcase asserts the same as for TargetClass1.
The jimple code of the branch in TargetClass1 is
Code: Alles auswählen
if h != b goto label1;
The jimple code of the branch in TargetClass2 is
Code: Alles auswählen
$b0 = v cmpl 0.0;
if $b0 <= 0 goto label1;
-
- Erstie
- Beiträge: 11
- Registriert: 30. Okt 2014 13:29
Re: Wrong testcase for sheet 4 task 1
Hi,
now I see the point, but the error was in TargetClass1, as there is actually no dead code. So I added an else Stmt in the targetclass, which is then of course dead at this point.
So for
you must report true as this branch (starting at label1) is then dead (becaue h == b always holds).
So please update the template from the repository!
now I see the point, but the error was in TargetClass1, as there is actually no dead code. So I added an else Stmt in the targetclass, which is then of course dead at this point.
So for
Code: Alles auswählen
if h != b goto label1;
So please update the template from the repository!