Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#2444 closed Bugs (fixed)

read_dimacs problem with gcc 4.3

Reported by: freiman@… Owned by: Andrew Sutton
Milestone: Boost 1.38.0 Component: graph
Version: Boost 1.36.0 Severity: Problem
Keywords: Cc:

Description

gcc version and system: g++ (Debian 4.3.1-9) 4.3.1

I tried to compile the graph example (boost/libs/graph/example/graph.cpp) using the following command: g++ -Wall -I /cs/phd/freiman/include/boost_1_36_0 graph.cpp -o graph

and got the following message about deprecated headers:



In file included from /usr/include/c++/4.3/backward/hash_set:64,

from

/cs/phd/freiman/include/boost_1_36_0/boost/graph/adjacency_list.hpp:22,

from graph.cpp:15:

/usr/include/c++/4.3/backward/backward_warning.h:33:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated.



The running of this file was o.k.

When I tried to compile the kolmogorov max-flow example (boost/libs/graph/example/kolmogorov-eg.cpp) using the following command:

g++ -Wall -I /cs/phd/freiman/include/boost_1_36_0 kolmogorov-eg.cpp -o

kolmogorov-eg

I got the following:



In file included from /usr/include/c++/4.3/backward/hash_set:64,

from

/cs/phd/freiman/include/boost_1_36_0/boost/graph/adjacency_list.hpp:22,

from kolmogorov-eg.cpp:36:

/usr/include/c++/4.3/backward/backward_warning.h:33:2: warning: #warning This file includes at least one deprecated or antiquated header which may be removed without further notice at a future date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To disable this warning use -Wno-deprecated. In file included from kolmogorov-eg.cpp:37: /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp: In function 'int boost::read_dimacs_max_flow(Graph&, CapacityMap, ReverseEdgeMap, typename boost::graph_traits<G>::vertex_descriptor&, typename boost::graph_traits<G>::vertex_descriptor&, std::istream&)': /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:140: error: there are no arguments to 'strcmp' that depend on a template parameter, so a declaration of 'strcmp' must be available /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:140: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp: In function 'int boost::read_dimacs_max_flow(Graph&, CapacityMap, ReverseEdgeMap, typename boost::graph_traits<G>::vertex_descriptor&, typename boost::graph_traits<G>::vertex_descriptor&, std::istream&) [with Graph = main()::Graph, CapacityMap = boost::adj_list_edge_property_map<boost::directed_tag, long int, long int&, unsigned int, boost::property<boost::edge_capacity_t, long int, boost::property<boost::edge_residual_capacity_t, long int, boost::property<boost::edge_reverse_t, boost::detail::edge_desc_impl<boost::directed_tag, unsigned int>, boost::no_property> > >, boost::edge_capacity_t>, ReverseEdgeMap = boost::adj_list_edge_property_map<boost::directed_tag, boost::detail::edge_desc_impl<boost::directed_tag, unsigned int>, boost::detail::edge_desc_impl<boost::directed_tag, unsigned int>&, unsigned int, boost::property<boost::edge_capacity_t, long int, boost::property<boost::edge_residual_capacity_t, long int, boost::property<boost::edge_reverse_t, boost::detail::edge_desc_impl<boost::directed_tag, unsigned int>, boost::no_property> > >, boost::edge_reverse_t>]': kolmogorov-eg.cpp:93: instantiated from here /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:105: warning: deprecated conversion from string constant to 'char*' kolmogorov-eg.cpp:93: instantiated from here /cs/phd/freiman/include/boost_1_36_0/boost/graph/read_dimacs.hpp:140: error: 'strcmp' was not declared in this scope



which has error due to the strcmp function in line 140 in the file: read_dimacs.hpp I added the required header file (string.h) and only the warnings remain.

When I tried to run this example using the following command:

kolmogorov-eg < max_flow.dat

I got a segmentation fault:

I tried to understand where the seg. fault came from using valgrind and it runs without seg. fault but with many "invalid read" errors, that seems to come from the file read_dimacs.hpp, line 118

Using the same code with WinXP and visual studio 2003, yields no problems.

Change History (6)

comment:1 by Jürgen Hunold, 14 years ago

Simply #define BOOST_NO_HASH. This will disable hash_* support of the BGL and thus silence the warnings. I've done this here.

That would be nice if Boost.Config could detect this. Unfortunately, the new headers are only available with --std=cxx0x and this opens a new can of worms...

comment:2 by freiman@…, 14 years ago

Solved only the first warning, and not the: "deprecated conversion from string constant to 'char*" in read_dimacs.hpp line 105. In addition the seg. fault from the kolmogorov-eg example was not solved by this.

comment:3 by Andrew Sutton, 14 years ago

Component: Nonegraph
Owner: set to Andrew Sutton

comment:4 by Andrew Sutton, 14 years ago

Resolution: fixed
Status: newclosed

(In [49554]) Added a compiler check to adjacency_list.hpp that checks for GCC >= 4.3 and defines BOOST_NO_HASH. Closes #2444.

comment:5 by Andrew Sutton, 14 years ago

Milestone: Boost 1.37.0Boost 1.38.0

Note that this fix (r49554) will break any code that uses hash* selectors under GCC >= 4.3 - which is probably the right thing to do since hash_* was deprecated in favor of the unordered* data structures in tr1/0x. See #2467 for more information.

comment:6 by Andrew Sutton, 14 years ago

Reverted previous compiler check (r49554). It's probably not a good idea to deprecate these. Will add documentation on how to get around warnings.

Note: See TracTickets for help on using tickets.