Bug #6011
closed
Concatenation of bit vectors with 64-bit result
Added by Mikhail Chupilko over 9 years ago.
Updated over 9 years ago.
Assignee:
Andrei Tatarnikov
Published in build:
150605
Description
NML-spec:
t<31..0> = 0xffffffff;
t<63..32> = 0x77777777;
trace("t=%x", t);
t = t<31..0>::t<63..32>;
trace("t=%x", t);
Result of execution:
t=77777777ffffffff
t=7777777777777777
The same assignment but for a 32-bit result works as expected.
Example to reproduce:
final Memory t = Memory.def(Kind.VAR, "t", Type.INT(64), 1);
t.access().bitField(31, 0).store(DataEngine.valueOf(Type.INT(32), 0xffffffffL));
t.access().bitField(63, 32).store(DataEngine.valueOf(Type.INT(32), 0x77777777));
trace("t=%x", t.access().load().getRawData().longValue());
trace("t=%x", Location.concat(t.access().bitField(63, 32), t.access().bitField(31, 0)).load().getRawData().longValue());
t.access().store(Location.concat(t.access().bitField(63, 32), t.access().bitField(31, 0)).load());
trace("t=%x", t.access().load().getRawData().longValue());
You are reading and writing to the same location simultaneously. This happens because the load() method does not actually create a copy of the data, it just provides a view on this data. This is done to avoid redundant copying. There two solutions:
1. You do not do this (have to use a temporary variable).
2. I have to create a copy of the data each time load() is called.
- Status changed from New to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
- Published in build set to 150605
Also available in: Atom
PDF