Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5081108

reflective access to final longs loses uppper 32 bits on some x86 machines

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1 P1
    • 6
    • 6
    • hotspot
    • mustang
    • x86
    • solaris_10

        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

              phh Paul Hohensee
              martin Martin Buchholz
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: