From: Francois T. <fra...@la...> - 2002-11-01 20:10:16
|
Hi again, I'm applying OpenC++ on a program with namespaces and double inheritance, and occ seems to have troubles when it encounters the following pattern: (which compile correctly with "g++ -c".) -- class A{}; namespace N { class B { }; class A : virtual public ::A, virtual public B {}; } -- If I launch occ on this bit of code (here for instance with the default metaclass Class), I get a segmentation fault: -- $ /usr/bin/occ -E -SClass test2.cc zsh: segmentation fault /usr/bin/occ -SClass test2.cc -- I've used gdb to investigate what was going on and it seems occ is trapped in an infinite recursion. Below is what the bottom of the stack looks like just after the segfault. Environment::SearchBaseOrUsing () and Environment::LookupType() recursively call each other until the memory space available to the stack gets exhausted. --- <--snip-- Infinite recursion leading to segmentation fault--> .. #32640 0x08069434 in Environment::SearchBaseOrUsing () #32641 0x080693c9 in Environment::LookupType () #32642 0x08069434 in Environment::SearchBaseOrUsing () #32643 0x080693c9 in Environment::LookupType () #32644 0x08069434 in Environment::SearchBaseOrUsing () #32645 0x080693c9 in Environment::LookupType () #32646 0x08069434 in Environment::SearchBaseOrUsing () #32647 0x080693c9 in Environment::LookupType () #32648 0x080692bb in Environment::LookupClassMetaobject () #32649 0x0806af6f in Walker::RecordBaseclassEnv () #32650 0x08085764 in ClassWalker::RecordMembers () #32651 0x08085245 in ClassWalker::TranslateClassSpec () #32652 0x0806c799 in Walker::TranslateClassSpec () #32653 0x08062904 in PtreeClassSpec::Translate () #32654 0x0806b014 in Walker::Translate () #32655 0x0806d72d in Walker::TranslateTypespecifier () #32656 0x0806b8d3 in Walker::TranslateDeclaration () #32657 0x08062440 in PtreeDeclaration::Translate () #32658 0x0806b014 in Walker::Translate () #32659 0x0806c3a8 in Walker::TranslateBrace () #32660 0x08062244 in PtreeBrace::Translate () #32661 0x0806b014 in Walker::Translate () #32662 0x0806b765 in Walker::TranslateNamespaceSpec () #32663 0x08062394 in PtreeNamespaceSpec::Translate () #32664 0x0806b014 in Walker::Translate () #32665 0x0805de0a in Compile () #32666 0x0805db2a in Compile () #32667 0x0805d941 in Compile () #32668 0x0805d834 in Compile () #32669 0x0805d7b4 in main () #32670 0x400ca0bf in __libc_start_main () from /lib/libc.so.6 --- Interstingly, the segfault disappears if I remove any of the base classes of N::A. For instance occ works fine on -- class A{}; namespace N { class B { }; class A : virtual public ::A // , virtual public B {}; } -- The problem also disappears if I use another name for N::A (one that does not mask ::A). I think this is a bug, but I'm not sure. Would someone have any comment on it ? Thanks in advance Francois -- Francois Taiani +33 (0) 5 6133 6406 LAAS-CNRS (http://www.laas.fr) Dependable Computing http://www.laas.fr/~ftaiani and Fault Tolerance |