简体   繁体   中英

How to debug segmentation fault of g++?

I tried to compile the code using g++4.4.6 on aix 6.1. I dont have gdb installed. After compilation, It is showing Segmentation Fault error:-

../test/Corner.h: In member function 'void VirtualFlow<T>::vector_flow(typename T::Data**, typename T::Data**) [with T = NProcess<or_func<NetAndVal<ZVal2>, with_derivatives>, ConvexNoOverlapSize<16, 16, Multiply<65536l, AllPass<CornerT<NetAndVal<ZVal2> >, NoFlow<CornerT<NetAndVal<ZVal2> > > > > > >]':
../test/Corner.h:369: internal compiler error: Segmentation fault

I tried to use -g option with to create .o file and looked for the problem.

opt/freeware/bin/g++ -g ConnectFlow2.C -o ConnectFlow2.o

but I was not able to debug.

Please share good practices of how to debug the segmentation fault.

Thanks.

Simplify the code to leave the bare minimum for which the ICE still occurs and submit a bug report to GCC project. They have much higher chances of resolving it than you do.

It's just a guess, but it would worth trying to increase template depth with -ftemplate-depth-103 . I don't know what is the default value, and how deep is your template-structure.

I suggest upgrading your GCC compiler (since your old 4.4 compiler crashes). Try to get the GCC 4.6 source code then build it.

Don't forget to worry about dependencies, and to carefully read and follow the installation instructions (in particular, don't build in the source directory!).

If you really want to debug your compiler by yourself, rebuild it from source and recompile it with -g

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM