|
Boost Users : |
From: Franck.Caron_at_[hidden]
Date: 2003-09-29 11:53:23
Hi all,
I have a problem while compiling BGL with gcc 3.1.1 on solaris7 with the -O2
optimizer option.
All is ok with -g (debug) but -O2 produce a crash at runtime
Here is a code that reproduce the problem :
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/properties.hpp>
#include <iostream>
#include <string>
using namespace std;
using namespace boost;
struct VertexPropertyTag {
typedef vertex_property_tag kind;
};
typedef property<VertexPropertyTag,string> VertexProp;
typedef adjacency_list<setS,vecS,bidirectionalS,VertexProp> Graph;
int main(){
Graph graph;
graph_traits<Graph>::vertex_descriptor v1 =
add_vertex(string("s1"),graph);
graph_traits<Graph>::vertex_descriptor v2 =
add_vertex(string("s2"),graph);
add_edge(v1,v2,graph);
graph_traits<Graph>::edge_iterator eIt,eItEnd;
tie(eIt,eItEnd) = edges(graph);
for(;eIt != eItEnd;++eIt){
cout << "->" << *eIt << endl;
}
return 0;
}
With
g++ -Wall -pedantic -fPIC -g -c -o solaris7/gcc3.1/Main.o Main.cc -I.
-I/opt/boost_1.30.2
g++ -fPIC -o solaris7/gcc3.1/testbug.exe solaris7/gcc3.1/Main.o -L
/opt/boost_1.30.2/libs/gcc3.1/release/single-thread -R -Wl,-Bdynamic
Here is the result :
shell> solaris7/gcc3.1/testbug.exe
->(0,1)
It is OK
With
g++ -Wall -pedantic -fPIC -O2 -c -o solaris7/gcc3.1/Main.o Main.cc -I.
-I/opt/boost_1.30.2
g++ -fPIC -o solaris7/gcc3.1/testbug.exe solaris7/gcc3.1/Main.o -L
/opt/boost_1.30.2/libs/gcc3.1/release/single-thread -R -Wl,-Bdynamic
Here is the result :
shell> solaris7/gcc3.1/testbug.exe
->(0,1)
->(0,0)
Bus error (core dumped)
Does anybody already had this ?
Is it a bug in my code, in BGL or in gcc ?
Thanks for the help.
Franck
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net