compilation error of my example raytracer program
Hi! I've tried to compile this program: http://pastebin.com/m38177b25 and I've got this error: http://pastebin.com/m46f39bed It compiles fine with ghc. It does not use special library. The error message is not so useful for me :) Any idea? Cheers, Csaba Hruska
What a productive test case! Two important bugs and one feature request exposed! Hi, for some reason you need to compile it with -fno-monomorphism-restriction. I am not sure why jhc needs that and ghc doesn't, I think there must be a bug in the way I implement it. thanks for the test case! The reason the error message seems oddly verbose is that it is printed after renaming has been done, so everything has its fully qualified name. 'unqualifying' code before printing it in error messages would be a really useful feature. When I compile it, the C code doesn't compile because it has things like 'sinf(0.0)' in places where C expects a constant. So, this is a bug in the C code generator. to jhc, sinf(0.0) is a constant expression, but due to C's rules, I can't use it as such. Hmm.. hopefully I can find a way around this that won't hurt performance. being able to treat things as constant is a huge win. I will have to mull on it, a quick n dirty fix is to stop treating Sin as a pure operation. In any case, thanks for the example! A lot of the bugs in jhc are quite shallow but they just need to be reported. :) On the subject of bugs, how do people feel about ditz? http://ditz.rubyforge.org/ it's design appeals to me, but I have not used it before. John -- John Meacham - ⑆repetae.net⑆john⑈
Hi, I have patched jhc so your example will run, if you don't want to recompile jhc, I have attached the generated C file. simply compile it with gcc -m32 '-std=gnu99' -D_GNU_SOURCE '-falign-functions=4' -ffast-math -DNDEBUG -O3 -fomit-frame-pointer -o hruska_ray hruska_ray_code.c or you can use the recomp.prl script that comes with jhc in the utils directory to recompile C code generated by jhc with different options. John -- John Meacham - ⑆repetae.net⑆john⑈
participants (2)
-
Csaba Hruska -
John Meacham