Bizarre Haskell Problem
Matthew Donadio
m.p.donadio at ieee.org
Tue Jan 28 15:13:31 EST 2003
Hello,
I am having a bizarre Haskell problem that I am having difficulty
debugging. I am not positive this is a compiler problem, but my results
are not making any sense.
I have attached a few source files which compiled with ghc-5.04.2
running under Win95. The files were compiled as:
ghc -c DFT.lhs
ghc -c FFT1.lhs
ghc -c FFT2.lhs
ghc -c Main1.hs
ghc -c Mail2.hs
ghc -o test1 Main1.o FFT1.o DFT.o
ghc -o test2 Main2.o FFT2.o DFT.o
Running test1 gives the following results (the last line is wrong):
foo 19: [1,2,4,8,16,13,7,14,9,18,17,15,11,3,6,12,5,10]
rader1 19: [1,2,4,8,16,13,7,14,9,18,17,15,11,3,6,12,5,10]
foo 23: [1,5,2,10,4,20,8,17,16,11,9,22,18,21,13,19,3,15,6,7,12,14]
rader1 23: [1,5,2,10,4,20,8,17,16,11,9,22,18,21,1,4,8,18,22,6,19,2]
Running test2 gives the following results (these are the results I
expect):
foo 19: [1,2,4,8,16,13,7,14,9,18,17,15,11,3,6,12,5,10]
rader1 19: [1,2,4,8,16,13,7,14,9,18,17,15,11,3,6,12,5,10]
foo 23: [1,5,2,10,4,20,8,17,16,11,9,22,18,21,13,19,3,15,6,7,12,14]
rader1 23: [1,5,2,10,4,20,8,17,16,11,9,22,18,21,13,19,3,15,6,7,12,14]
The only difference bewteen the sources is that in FFT1.lhs, lines 215
and 217 are present, while in FFT2.lhs, they are commented out. Note
that these two lines reference the parameter, f. Also note that rader1
calls foo, so I am confused as to how that can produce different
results, as test1 shows. FFT1.rader1 works for all n <= 19, but fails
for n >= 23 (n has to be prime, however). Also, if I copy the offending
code from FFT1.lhs to a separate file, then I get the results I expect,
but this is a less than ideal solution.
ghc-5.04.2 was installed with the Windows Installer from the website.
If you play with the code, foo n should produce a permutation of the
sequence [1..(n-1)] for all prime n (ie, foo n produces the permutation
for a generator of the Galois field n).
I appologize in advance if this is a bug on my part, but based on what I
am seeing, I am getting results that should not happen.
Thanks.
--
Matthew Donadio (m.p.donadio at ieee.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FFT2.lhs
Type: haskellprogram
Size: 13372 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-bugs/attachments/20030128/a393b75d/FFT2.bat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Main2.hs
Type: haskellprogram
Size: 274 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-bugs/attachments/20030128/a393b75d/Main2.bat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DFT.lhs
Type: haskellprogram
Size: 2004 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-bugs/attachments/20030128/a393b75d/DFT.bat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FFT1.lhs
Type: haskellprogram
Size: 13391 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-bugs/attachments/20030128/a393b75d/FFT1.bat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Main1.hs
Type: haskellprogram
Size: 274 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/glasgow-haskell-bugs/attachments/20030128/a393b75d/Main1.bat
More information about the Glasgow-haskell-bugs
mailing list