[Soot-list] Bytes and signedness

Almo aaloanmiftah at yahoo.com
Sun Jul 15 20:10:21 EDT 2012


Hey,

There are no unsigned types in java.


________________________________
 From: David Given <dg at cowlark.com>
To: "soot-list at sable.mcgill.ca" <soot-list at sable.mcgill.ca> 
Sent: Sunday, July 15, 2012 2:55 PM
Subject: [Soot-list] Bytes and signedness
 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120715/6c577aa7/attachment.html 


More information about the Soot-list mailing list