kubo39's blog

ただの雑記です。

nimのcast[string]がバグってるぽい件

再現コード

import unsigned, sequtils

echo cast[string](newSeq[uint8](10).mapIt(string, $(it)))

出力結果がランダムに変わってるけど、この挙動はおかしいのではなかろうか。

( ՞ਊ ՞) :~/dev/nim $ nim -version
Nim Compiler Version 0.11.2 (2015-05-04) [Linux: amd64]
Copyright (c) 2006-2015 by Andreas Rumpf

git hash: 3bef848a2cf60008f23e72571d7c20c0eb9fd728
active boot switches: -d:release
( ՞ਊ ՞) :~/dev/nim $ nim c hoge.nim | tail -1
Hint: operation successful (9754 lines compiled; 0.140 sec total; 14.143MB; Debug Build) [SuccessX]
( ՞ਊ ՞) :~/dev/nim $ for n in {98..90}
> do
> ./hoge 
> done
x
xзG�
x��,
x
xp[TB
x .
x�
xp`/�
x �c
( ՞ਊ ՞) :~/dev/nim $ 

masterだとなおってたりしないかな。 Issueさらってなかったら報告しよう、というのを忘れないためのメモ。

[追記]

最近のmasterでもやはりランダムに出力されている。

$HOME/Nim/bin/nim -version
Nim Compiler Version 0.11.2 (2015-05-20) [Linux: amd64]
Copyright (c) 2006-2015 by Andreas Rumpf

git hash: 45b6082c12dd6fc90a3dd3ca97e1ba157c3d6464
active boot switches: -d:release
% for i in {0..9}
do
./hoge
done
x���
x�VQ
xpiY�
x
  A
xp�k�
x ��\
x��_
x��ӱ
x�
x0])