[Soot-list] Bytes and signedness

Eric Bodden eric.bodden at ec-spride.de
Sun Jul 15 19:55:51 EDT 2012


Hmmm, if what David is writing is correct, then I think this really
looks like a bug. David, so what happens when you convert such code
back to .class ? What happens when you run it?

Eric

On 15 July 2012 15:55, David Given <dg at cowlark.com> wrote:
> So I've got this code:
>
>         public static boolean test(float f1, float f2)
>         {
>                 return (f1 < f2);
>         }
>
> If I translate it to jimple, I see this:
>
>     public static boolean test(float, float)
>     {
>         float f0, f1;
>         byte $b0;
>
>         f0 := @parameter0: float;
>         f1 := @parameter1: float;
>         $b0 = f0 cmpg f1;
>         if $b0 >= 0 goto label0;
>
>         return 1;
>
>      label0:
>         return 0;
>     }
>
>
> I notice that it's inferred the return type of cmpg and cmpl as a byte.
> Unfortunately, bytes are unsigned, which means that they are always
> non-negative, which means that the naive interpretation of the above
> code will always return 0.
>
> I know that the JVM has no concept of types smaller than an int, so the
> above situation would never really happen, but nevertheless, this does
> seem odd...
>
> --
> ┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
>> │ life←{ ↑1 ⍵∨.^3 4=+/,¯1 0 1∘.⊖¯1 0 1∘.⌽⊂⍵ }
> │ --- Conway's Game Of Life, in one line of APL
>
>
> _______________________________________________
> 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