This program:
public class Trunc2 {
private static final long x = 1421746759512286392L;
public static void main(String[] args) throws Exception {
long x2 = Trunc2.class.getDeclaredField("x").getLong(null);
if (x2 != x)
throw new Exception(""+x2);
}
}
should print nothing, and indeed this is what happens on most platforms.
But on some VIA EPIA x86 Solaris machines, this happens:
Exception in thread "main" java.lang.Exception: 558556344
at Trunc2.main(Trunc2.java:6)
This started happening with Tiger b51 and persists as of b60.
The suspicious bug fixes that may have been introduced are
5037108: Low-byte of Long Truncated Incorrectly by Bitwise AND
5044412: (reflect) if setAccessible(true) has succeeded, allow final fields to be set
If the "final" is removed, no exception is thrown.
This bug is responsible for the failure of Solaris 10 to install on
these machines, documented in
5060088: cd 2of3 won't install on some VIA EPIA systems
One machine where this bug can be reproduced is "small.sfbay".
###@###.### 2004-07-30