[Soot-list] Bytes and signedness
David Given
dg at cowlark.com
Sun Jul 15 16:55:00 EDT 2012
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
Url : http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120715/f4855d57/attachment.bin
More information about the Soot-list
mailing list