Project

General

Profile

Actions

Bug #6011

closed

Concatenation of bit vectors with 64-bit result

Added by Mikhail Chupilko over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Andrei Tatarnikov
Category:
-
Target version:
Start date:
06/02/2015
Due date:
% Done:

100%

Estimated time:
Detected in build:
svn
Platform:
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.

Actions #1

Updated by Andrei Tatarnikov over 9 years ago

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());
Actions #2

Updated by Andrei Tatarnikov over 9 years ago

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.

Actions #3

Updated by Andrei Tatarnikov over 9 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Fixed: r3785.

Actions #4

Updated by Andrei Tatarnikov over 9 years ago

  • Status changed from Resolved to Closed
  • Published in build set to 150605
Actions

Also available in: Atom PDF