SGCC 4.0.3 error: Segment Fault
fstream.cpp:1177: internal compiler error: Segmentation Fault
Platform:
Solaris 10 3/05 for SPARC
SGCC version 4.0.3
PATH is /opt/gcc/bin:/usr/sbin:/usr/bin:/usr/sfw/bin:/usr/css/bin
Source Code
STLport-4.6.2 (www.stlport.org/download.html)
How to re create:
After installation, modify the gcc-sun.make as the following:
CXX = g++ -pthreads
DYN_LINK=g++ -pthreads -shared -o
modify stl_port/stl/_config.h Line 632
#define _STLP_TEMPLATE template
After that, create a symobl link
ln -s /opt/gcc/include/c++/4.0.3 STL_HOME/stlport/g++-v3
In the STL_HOME/src folder, compile it with the following command
gmake gcc-sun.mak
It will generate the Segment Fault
[764 byte] By [
adam.zhang] at [2007-11-26 10:22:34]

# 1
Hello, Adam,
The segmentation fault is due to compilation with -gstabs.
Current SGCC does not support stabs format yet.
Please change the gcc-sun.mak file and replace -gstabs
with -g.We will change in the next release to give proper
warning message for the -gstabs flag.
Thanks.
Chih-Hung
# 4
> I'm also getting a Segmentation fault reported with
> this version of g++.
>
> The error reads
> "g++: internal error: Segmentation Fault ( program
> cg)"
>
> I can't produce a simple test case but a could send a
> preprocessed ( -E) file.
Thank you for preprocessed files.
The problem you reported is not related to -gstabs issue.
We managed to reproduce the coredump with ccrlist, but not with viopanel.
What flags did you use ? What Solaris version ?
# 6
> Running on Solaris 10
>
> Using the following compile fiags:
> -c -Wall -W -Wno-unused -fno-rtti
> -Wno-non-virtual-dtor -O2 -fPIC
>
> The code compiles ok when the -O2 is removed
>
>
> David
Thanks.
Now we can reproduce the problem for both testcases.
btw -O1 is working, so please use it as a workaround until we have a proper fix.
# 7
> so please use it as a workaround until we have a proper fix.
We've just released a patch for GCCfss 4.0.3. It's located at the same place place on SDLC website (the link is on the front page).
Please download it, remove old 4.0.3 packages and install new 4.0.3 packages.
This patch contains the fix for the above CG segmentation fault with -O2 -fPIC plus fixes for other problems reported on the forum.