On Mon, 12 Feb 2001 maxa@frodo.jia.czn.cz wrote:
Thank you very much for the static library. I compared your and my library and I find some differences (for example: "nm cl_prin_globals.o"):
correct: 00000000000001a0 T _GLOBAL_$D$cl_module__cl_prin_globals__firstglobalfun U _GLOBAL_$D$cl_module__cl_st_null__firstglobalfun 0000000000000160 T _GLOBAL_$I$cl_module__cl_prin_globals__firstglobalfun U _GLOBAL_$I$cl_module__cl_st_null__firstglobalfun
wrong: 00000000000001a0 t _GLOBAL_$D$_3cln$default_print_flags U _GLOBAL_$D$cl_module__cl_prin_globals__firstglobalfun U _GLOBAL_$D$cl_module__cl_st_null__firstglobalfun 0000000000000160 t _GLOBAL_$I$_3cln$default_print_flags U _GLOBAL_$I$cl_module__cl_prin_globals__firstglobalfun U _GLOBAL_$I$cl_module__cl_st_null__firstglobalfun
And since you mentioned the optimization, I tried different levels, and the solution is here! G++ miscompiles CLN if no optimization (-O0) is used and if too much optimization (-O3) is used. So, when I switched back to -O2 level, all is fine. Great!
Thank you very much for finding out what causes the problem. It is well known that the PROVIDE/REQUIRE macros defined in include/cln/modules.h cannot work with -O0. This is why the CLN configure script sets CXXFLAGS to -O (equivalent to -O1) if you haven't specified it. This is in contrast to other configure scripts which set it to -O2 -g. But -O2 doesn't help CLN much. The main differerence between -O1 and -O2 is the enhanced scheduling. But since an awful amount of code in CLN is of the if (((long)p & 3) == 0) *((int*)p)++ kind, scheduling cannot take much effect at such short basic block sizes. Inlining, in contrast, as switched on with -O1 helps a lot. I still have to find out what goes wrong with -O3. Regards -richy. -- Richard Kreckel <Richard.Kreckel@Uni-Mainz.DE> <http://wwwthep.physik.uni-mainz.de/~kreckel/>