Hi all, I found a bug (?) in g77 3.3's optimization of PIC code (at least on i386), leading to bug # 233689 (closed by the workaround of compiling the affected file without optimization). The problem is that a segfault occurs with code which is called from a dynamic library that doesn't happen when the code is linked in statically. I believe part of the issue is that the FORTRAN function in question: http://borex.princeton.edu/~kmccarty/g77-bug/csrfun.F has multiple entry points. However I haven't been able to construct a simple test case for the bug (which is why I haven't filed anything in the BTS), so assistance is greatly appreciated.
How you can help: - Install (with apt-get) the package "paw" on i386/unstable, then obtain and install (with dpkg -i) the three debs in this directory, which are compiled optimized but not stripped: http://borex.princeton.edu/~kmccarty/g77-bug/ - Download this file: http://borex.princeton.edu/~kmccarty/g77-bug/ttt.kumac to some appropriate test directory and cd to that directory. - The bug can be triggered by running pawX11.dynamic (in the "paw" package) and, at the PAW> prompt, typing "exec ttt" (without the quotes). It cannot be triggered from pawX11.static (in the "paw-static" package). Presumably gdb/assembly gurus will be able to figure out what's wrong by looking at the assembly window in the former case... - Source code for the file is also in the above directory, as well as the results of 'g77 -save-temps ...' compiled in the appropriate ways. - Source code for the rest of cernlib (of which paw is a part) can be obtained with apt-get source paw; cd cernlib-* ; make -f debian/generic/Makefile patch - Here is my test framework (which as mentioned above, does not actually illustrate the bug in its current condition, but maybe someone can modify it so that it does): http://borex.princeton.edu/~kmccarty/g77-bug/g77-test.tar.gz Thanks for any light anyone can shed on this. The only other things I can add are that the bug doesn't happen with g77-2.95, and that the compilation options are as follows: - for the statically linked file, g77 -save-temps -g -c -O3 -fno-strength-reduce -funroll-loops -fomit-frame-pointer -fno-automatic -fno-second-underscore -fugly-complex -I/home/kmccarty/Downloads/programs/src/cernlib/cernlib-2003.09.03/build/pawlib/comis -I/home/kmccarty/Downloads/programs/src/cernlib/cernlib-2003.09.03/src/pawlib/comis -I/home/kmccarty/Downloads/programs/src/cernlib/cernlib-2003.09.03/src/pawlib/comis/code -I/home/kmccarty/Downloads/programs/src/cernlib/cernlib-2003.09.03/src/include -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC -DCERNLIB_DEBIAN -DDEBIAN_VERSION=\"2003.09.03-3\" -o archive/csrfun.o /home/kmccarty/Downloads/programs/src/cernlib/cernlib-2003.09.03/src/pawlib/comis/code/csrfun.F - for the file compiled with -fPIC, g77 -save-temps -g -c -O3 -fno-strength-reduce -funroll-loops -fomit-frame-pointer -fPIC -fno-automatic -fno-second-underscore -fugly-complex -I/home/kmccarty/Downloads/programs/src/cernlib/cernlib-2003.09.03/build/pawlib/comis -I/home/kmccarty/Downloads/programs/src/cernlib/cernlib-2003.09.03/src/pawlib/comis -I/home/kmccarty/Downloads/programs/src/cernlib/cernlib-2003.09.03/src/pawlib/comis/code -I/home/kmccarty/Downloads/programs/src/cernlib/cernlib-2003.09.03/src/include -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC -DCERNLIB_DEBIAN -DDEBIAN_VERSION=\"2003.09.03-3\" -o shared/csrfun.o /home/kmccarty/Downloads/programs/src/cernlib/cernlib-2003.09.03/src/pawlib/comis/code/csrfun.F - for the shared library libpaw1.so, gcc -shared -Wl,-soname=libpawlib.so.1 -o libpawlib.so.1.2003 \ `cat shared/objects.list` `cernlib -v "" -dy pawlib | sed s/-lpawlib//g` regards, -- Kevin B. McCarty <[EMAIL PROTECTED]> Physics Department WWW: http://www.princeton.edu/~kmccarty/ Princeton University GPG: public key ID 4F83C751 Princeton, NJ 08544