c++/9265: exception handling faulty wenn linking PIC objects to non PIC ones

rschiele@uni-mannheim.de rschiele@uni-mannheim.de
Mon Jan 13 05:17:00 GMT 2003


>Number:         9265
>Category:       c++
>Synopsis:       exception handling faulty wenn linking PIC objects to non PIC ones
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 10 10:56:02 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Robert Schiele
>Release:        3.2.1, 3.2.2 20030109 (prerelease), 3.3 20030109 (prerelease) and 3.4 20030109 (experimental)
>Organization:
>Environment:
System: Linux scavenger 2.4.19-4GB #1 Mon Oct 14 22:11:39 UTC 2002 i686 unknown
Architecture: i686
host: i486-suse-linux-gnu
build: i486-suse-linux-gnu
target: i486-suse-linux-gnu
configured with: /home/schiele/gcccvs/gcc-3.2.1/configure --enable-threads=posix --prefix=/opt/Pkg/Linux/i686/gcc321 --enable-languages=c,c++,f77,objc --disable-libgcj --with-gxx-include-dir=/opt/Pkg/Linux/i686/gcc321/include/g++ --with-system-zlib --enable-shared --enable-__cxa_atexit i486-suse-linux
>Description:
When linking a PIC object to a non PIC one that calls a function by a function pointer, exception handling is no longer working in the PIC object.

I could reproduce this on ia32 arch.  On sparc it did not happen for me.

Note, I am not abolutely sure whether this is a bug, as I do not now what the specs say about linking PIC to non PIC objects in C++.  But as I do not sea a reason, why this should not be allowed, I assume this is a bug.

The attached lines of code should output nothing, as the thrown exception is expected to be called immediately, but they print out an "Aborted".
>How-To-Repeat:
echo 'int main() { try { throw 0; } catch (...) {}}' | \
  g++ -fpic -c -x c++ -o pic.o -
echo 'void (*b)(); void a() { (*b)(); }' | g++ pic.o -x c++ -
a.out
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list