BUG DESCRIPTION:Erroneous results when using uint8, uint16 or uint32 as an index inside bitset function
----------------
ERROR LOG: see below
----------
HOW TO REPRODUCE THE BUG:by running the sequences of instructions given below
The following sequence is OK (both versions 5.5.2 and 6.0.0)
write(%io(2),'Example 1')
test_list=list(9,10,11,12) //Type double
//
value=uint16(0)
for ind=test_list
value=bitset(value,ind) //ind of type double
end
write(%io(2),' Case 1, value = '+dec2hex(value))
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint16(ind)) //ind of type uint16
end
write(%io(2),' Case 2, value = '+dec2hex(value))
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint32(ind)) //ind of type uint32
end
write(%io(2),' Case 3, value = '+dec2hex(value))
//
//
//
write(%io(2),'Example 2')
test_list=list(uint8(9),uint8(10),uint8(11),uint8(12)) //Type uint8
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint16(ind)) //ind of type uint16
end
write(%io(2),' Case 1, value = '+dec2hex(value))
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint32(ind)) //ind of type uint32
end
write(%io(2),' Case 2, value = '+dec2hex(value))
//
//
//
write(%io(2),'Example 3')
test_list=list(uint16(9),uint16(10),uint16(11),uint16(12)) //Type uint16
//
value=uint16(0)
for ind=test_list
value=bitset(value,ind) //ind of type double
end
write(%io(2),' Case 1, value = '+dec2hex(value))
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint16(ind)) //ind of type uint16
end
write(%io(2),' Case 2, value = '+dec2hex(value))
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint32(ind)) //ind of type uint32
end
write(%io(2),' Case 3, value = '+dec2hex(value))
//
//
//
write(%io(2),'Example 4')
test_list=list(uint32(9),uint32(10),uint32(11),uint32(12)) //Type uint 32
//
value=uint16(0)
for ind=test_list
value=bitset(value,ind) //ind of type double
end
write(%io(2),' Case 1, value = '+dec2hex(value))
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint16(ind)) //ind of type uint16
end
write(%io(2),' Case 2, value = '+dec2hex(value))
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint32(ind)) //ind of type uint32
end
write(%io(2),' Case 3, value = '+dec2hex(value))
with console message
-->exec('C:\Users\AARON\Documents\Gilles\Essais Scilab\Bug uint\bitset_ok.sci', -1)
Example 1
Case 1, value = F00
Case 2, value = F00
Case 3, value = F00
Example 2
Case 1, value = F00
Case 2, value = F00
Example 3
Case 1, value = F00
Case 2, value = F00
Case 3, value = F00
Example 4
Case 1, value = F00
Case 2, value = F00
Case 3, value = F00
The following sequence gives erroneous results (both versions 5.5.2 and 6.0.0)
write(%io(2),'Example 1')
test_list=list(9,10,11,12) //Type double
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint8(ind)) //ind of type uint8
end
write(%io(2),' Case 1, value = '+dec2hex(value))
//
//
//
write(%io(2),'Example 2')
test_list=list(uint8(9),uint8(10),uint8(11),uint8(12)) //Type uint8
//
value=uint16(0)
for ind=test_list
value=bitset(value,ind) //ind of type double
end
write(%io(2),' Case 1, value = '+dec2hex(value))
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint8(ind)) //ind of type uint8
end
write(%io(2),' Case 2, value = '+dec2hex(value))
//
//
//
write(%io(2),'Example 3')
test_list=list(uint16(9),uint16(10),uint16(11),uint16(12)) //Type uint16
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint8(ind)) //ind of type uint8
end
write(%io(2),' Case 1, value = '+dec2hex(value))
//
//
//
write(%io(2),'Example 4')
test_list=list(uint32(9),uint32(10),uint32(11),uint32(12)) //Type uint 32
//
value=uint16(0)
for ind=test_list
value=bitset(value,uint8(ind)) //ind of type uint8
end
write(%io(2),' Case 1, value = '+dec2hex(value))
with console message
-->exec('C:\Users\AARON\Documents\Gilles\Essais Scilab\Bug uint\bitset_notok.sci', -1)
Example 1
Case 1, value = 0
Example 2
Case 1, value = 0
Case 2, value = 0
Example 3
Case 1, value = 0
Example 4
Case 1, value = 0
-------------------------
OTHER INFORMATION:may be related with bug reports 12013 and 14655 ?
------------------