diff --git a/src/machine.cpp b/src/machine.cpp index 848b111588..e6f391ee32 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -861,7 +861,7 @@ parseFieldTable(Thread* t, Stream& s, object class_, object pool) if (flags & ACC_STATIC) { unsigned size = fieldSize(t, code); - unsigned excess = staticOffset % size; + unsigned excess = (staticOffset % size) % BytesPerWord; if (excess) { staticOffset += BytesPerWord - excess; } @@ -878,7 +878,7 @@ parseFieldTable(Thread* t, Stream& s, object class_, object pool) abort(t); // todo: handle non-static field initializers } - unsigned excess = memberOffset % fieldSize(t, code); + unsigned excess = (memberOffset % fieldSize(t, code)) % BytesPerWord; if (excess) { memberOffset += BytesPerWord - excess; } diff --git a/test/Misc.java b/test/Misc.java index f75b38d92c..d4a2b3251c 100644 --- a/test/Misc.java +++ b/test/Misc.java @@ -2,7 +2,22 @@ public class Misc { private static int alpha; private static int beta; private static byte byte1, byte2, byte3; + private int gamma; + private int pajama; + private boolean boolean1; + private boolean boolean2; + private long time; + + public Misc() { + expect(! boolean1); + expect(! boolean2); + + time = 0xffffffffffffffffL; + + expect(! boolean1); + expect(! boolean2); + } private String foo(String s) { return s;