This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13878] New: Uncaught exception on AIX with shared libraries


> g++ -v
Reading specs from /tools/pkg/gcc/3.3.2/lib/gcc-lib/powerpc-ibm-
aix5.1.0.0/3.3.2/specs
Configured with: ../gcc-3.3.2/configure --prefix=/tools/pkg/gcc/3.3.2 --with-
ld=/bin/ld --with-as=/bin/as --enable-languages=c,c++,f77
Thread model: aix
gcc version 3.3.2


Under some circumstances the GCC runtime environment is unable to find the 
right handler for an exception. I spend some days producing a small testcase. 
With no success. So I debugged the exception handling. 
I found out that one assumption made in the source does not hold for my program:

(from gcc/unwind-dw2-fde.c)
  /* Linear search through the classified objects, to find the one
     containing the pc.  Note that pc_begin is sorted descending, and
     we expect objects to be non-overlapping.  */

Actually the objects are overlapping. Somehow nearly all libraries share some 
fdes (Frame Descriptor Elements) in the shared memory segment (0xd). There is 
no problem when you have process local shared libraries (segment 0x2). They are 
still overlapping (at the end of the pc range). But the list seen_objects is 
sorted by pc_begin and the right object will be found.

But it is a problem when some shared objects start behind the shared fdes. 
(With behind I mean with a greater pc). Then some libraries have the same 
pc_begin (overlapping at the front) and _Unwind_Find_FDE can find the wrong 
object. 

I made the following workaround to handle this case too. Just search the list 
of seen_objects until search_object finds a fde. This works for me. But I think 
that the real bug lies somewhere else. Perhaps someone with more AIX or 
exception handling experience can say more to it.


*** gcc-3.2.1/gcc/unwind-dw2-fde.c	Mon Jan 21 14:08:31 2002
--- gcc-3.2.1-dbg/gcc/unwind-dw2-fde.c	Wed Jan 21 08:57:10 2004
***************
*** 985,991 ****
  	f = search_object (ob, pc);
  	if (f)
  	  goto fini;
- 	break;
        }
  
    /* Classify and search the objects we've not yet processed.  */
--- 985,990 ----

-- 
           Summary: Uncaught exception on AIX with shared libraries
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: joerg dot richter at pdv-fs dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-ibm-aix5.1.0.0
  GCC host triplet: powerpc-ibm-aix5.1.0.0
GCC target triplet: powerpc-ibm-aix5.1.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13878


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]