-
Notifications
You must be signed in to change notification settings - Fork 10
Description
I 've defined a data like this:
getBasicData :: Int -> Get BasicData
getBasicData n = BasicData
<$> genericGetVectorWith (return n) getInt32le
<*> genericGetVectorWith (return n) getInt32le
<*> genericGetVectorWith (return n) getInt32le
<*> genericGetVectorWith (return n) getInt32le
<*> genericGetVectorWith (return n) getFloatle
<*> genericGetVectorWith (return n) getWord8
While trying to print the data, it outputs:
[4850337,4850337,4850337,4850344,4850344,4850344,4850344,4850344,4850344,4850344]
[4850337,4850337,4850337,4850344,4850344,4850344,4850344,4850344,4850344,4850344]
[4850337,4850337,4850337,4850344,4850344,4850344,4850344,4850344,4850344,4850344]
[4850337,4850337,4850337,4850344,4850344,4850344,4850344,4850344,4850344,4850344]
[0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8]
[2,3,1,2,3,3,3,3,3,1]
It should be:
[-140392093,-140392093,-140392093,-140392093,-140392093,-140392093,-140392093,-140392093,-140392093,-140392093]
[316,2999,6687,0,278,1904,4098,5799,7449,9230]
[2956,6642,8567,232,1861,4055,5755,7407,9180,9340]
[4850337,4850337,4850337,4850344,4850344,4850344,4850344,4850344,4850344,4850344]
[0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8,0.8]
[2,3,1,2,3,3,3,3,3,1]
When mark this fuction as NOINLINE or set ghc option -fno-cse, the bug disappeared.