[Soot-list] boolean types in jimple
Eric Bodden
eric.bodden at ec-spride.de
Fri Dec 9 04:21:48 EST 2011
Hi Martin.
The problem is rather that bytecode contains only ints and no
booleans. Soot's type assigner does a pretty sophisticated range
analysis (looking at what range of numbers the int in question is
assigned) and actually *does* assign BooleanType.v() whenever the
range is {0,1}.
I just double-checked, the bytecode for the following Java method...
public static void main(String[] args) {
boolean b = true;
if(b) {
System.err.println(b);
}
}
... is translated to:
public static void main(java.lang.String[])
{
java.lang.String[] r0;
boolean z0;
java.io.PrintStream $r1;
r0 := @parameter0: java.lang.String[];
z0 = 1;
if z0 == 0 goto label0;
$r1 = <java.lang.System: java.io.PrintStream err>;
virtualinvoke $r1.<java.io.PrintStream: void println(boolean)>(z0);
label0:
return;
}
Note the type boolean for z0.
Do you have any concrete examples where this should succeed but fails?
Eric
On 8 December 2011 16:13, Martin Schäf <martinschaef at googlemail.com> wrote:
> Hi,
>
> I'm building a translation from jimple to boogie. Boogie cannot cast
> between int and boolean, but in jimple all boolean are represented as
> IntTypes.
> Getting the boolean types by implementing a type checker would be
> possible, but sounds like pain.
>
> Is there a cheap way to check if something used to be a boolean?
>
> Thanks,
> M
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
--
Eric Bodden, Ph.D., http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Principal Investigator in Secure Services at CASED
Tel: +49 6151 16-75422 Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
More information about the Soot-list
mailing list