id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 4528,Reference to stack memory associated with local variable 'x' returned,brian.doig@…,Daniel Wallin,"It looks like x is not being passed in by reference. Because of this a copy is made on the stack. The operator returns x.value as a reference which is dangerous since x will go out of scope. This bug occurred with Xcode 4 beta 2, and with the latest version of clang/llvm from the open source project. CompileC /Users/bdoig/Library/Developer/Xcode/DerivedData/WDStoreTest-dbsxxdunpvzihagbzjvgylinzzaf/Build/Intermediates/WDStoreTest.build/Debug-iphonesimulator/WDStoreTest.build/Objects-normal/i386/TopoSort.o /Users/bdoig/Dropbox/WData/TopoSort.mm normal i386 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler cd /Users/bdoig/Dropbox/WDStoreTest setenv LANG en_US.US-ASCII setenv PATH ""/Xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Xcode4/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"" /Xcode4/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -x objective-c++ -arch i386 -fmessage-length=0 -pipe -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -Wno-trigraphs -fpascal-strings -O0 -Wreturn-type -Wunused-variable -D__IPHONE_OS_VERSION_MIN_REQUIRED=30200 -isysroot /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk -fasm-blocks -mmacosx-version-min=10.6 -gdwarf-2 -fvisibility=hidden -fobjc-abi-version=2 -fobjc-legacy-dispatch -iquote /Users/bdoig/Library/Developer/Xcode/DerivedData/WDStoreTest-dbsxxdunpvzihagbzjvgylinzzaf/Build/Intermediates/WDStoreTest.build/Debug-iphonesimulator/WDStoreTest.build/WDStoreTest-generated-files.hmap -I/Users/bdoig/Library/Developer/Xcode/DerivedData/WDStoreTest-dbsxxdunpvzihagbzjvgylinzzaf/Build/Intermediates/WDStoreTest.build/Debug-iphonesimulator/WDStoreTest.build/WDStoreTest-own-target-headers.hmap -I/Users/bdoig/Library/Developer/Xcode/DerivedData/WDStoreTest-dbsxxdunpvzihagbzjvgylinzzaf/Build/Intermediates/WDStoreTest.build/Debug-iphonesimulator/WDStoreTest.build/WDStoreTest-all-target-headers.hmap -iquote /Users/bdoig/Library/Developer/Xcode/DerivedData/WDStoreTest-dbsxxdunpvzihagbzjvgylinzzaf/Build/Intermediates/WDStoreTest.build/Debug-iphonesimulator/WDStoreTest.build/WDStoreTest-project-headers.hmap -F/Users/bdoig/Library/Developer/Xcode/DerivedData/WDStoreTest-dbsxxdunpvzihagbzjvgylinzzaf/Build/Products/Debug-iphonesimulator -I/Users/bdoig/Library/Developer/Xcode/DerivedData/WDStoreTest-dbsxxdunpvzihagbzjvgylinzzaf/Build/Products/Debug-iphonesimulator/include -I/Users/bdoig/Documents/Projects/boost_1_43_0 -I/Users/bdoig/Library/Developer/Xcode/DerivedData/WDStoreTest-dbsxxdunpvzihagbzjvgylinzzaf/Build/Intermediates/WDStoreTest.build/Debug-iphonesimulator/WDStoreTest.build/DerivedSources/i386 -I/Users/bdoig/Library/Developer/Xcode/DerivedData/WDStoreTest-dbsxxdunpvzihagbzjvgylinzzaf/Build/Intermediates/WDStoreTest.build/Debug-iphonesimulator/WDStoreTest.build/DerivedSources -include /Users/bdoig/Library/Developer/Xcode/DerivedData/WDStoreTest-dbsxxdunpvzihagbzjvgylinzzaf/Build/PrecompiledHeaders/WDStoreTest_Prefix-bwcwseswayysywfpkcwdmibmtjef/WDStoreTest_Prefix.pch -c /Users/bdoig/Dropbox/WData/TopoSort.mm -o /Users/bdoig/Library/Developer/Xcode/DerivedData/WDStoreTest-dbsxxdunpvzihagbzjvgylinzzaf/Build/Intermediates/WDStoreTest.build/Debug-iphonesimulator/WDStoreTest.build/Objects-normal/i386/TopoSort.o In file included from /Users/bdoig/Dropbox/WData/TopoSort.mm:11: In file included from /Users/bdoig/Dropbox/WData/TopoSort.h:20: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:16: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/depth_first_search.hpp:21: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/named_function_params.hpp:15: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/name.hpp:8: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/keyword.hpp:10: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/aux_/tag.hpp:8: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/aux_/tagged_argument.hpp:10: /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/aux_/arg_list.hpp:127:16:{127:16-127:23}: warning: reference to stack memory associated with local variable 'x' returned [2] return x.value; ^~~~~~~ In file included from /Users/bdoig/Dropbox/WData/TopoSort.mm:11: In file included from /Users/bdoig/Dropbox/WData/TopoSort.h:20: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:16: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/depth_first_search.hpp:21: /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/named_function_params.hpp:408:19: note: in instantiation of function template specialization 'boost::parameter::aux::empty_arg_list::operator[]' requested here [2] >()(g, ap[t | 0]); ^ /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/named_function_params.hpp:472:18: note: in instantiation of function template specialization 'boost::detail::override_const_property > > > const>, boost::parameter::aux::arg_list, boost::parameter::aux::empty_arg_list> >, boost::graph::keywords::tag::vertex_index_map, boost::vertex_index_t, boost::adjacency_list >' requested here [2] override_const_property( ^ /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/named_function_params.hpp:496:24: note: in instantiation of member function 'boost::detail::color_map_maker_helper<0, boost::adjacency_list, boost::parameter::aux::arg_list > > > const>, boost::parameter::aux::arg_list, boost::parameter::aux::empty_arg_list> >, boost::default_color_type, int>::make_map' requested here [2] return helper::make_map(g, white_color, ap[boost::graph::keywords::_color_map | 0], ap); ^ In file included from /Users/bdoig/Dropbox/WData/TopoSort.mm:11: In file included from /Users/bdoig/Dropbox/WData/TopoSort.h:20: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:16: /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/depth_first_search.hpp:300:72: note: in instantiation of member function 'boost::detail::color_map_maker, boost::parameter::aux::arg_list > > > const>, boost::parameter::aux::arg_list, boost::parameter::aux::empty_arg_list> > >::make_map' requested here [2] boost::detail::color_map_maker::make_map(g, arg_pack), ^ In file included from /Users/bdoig/Dropbox/WData/TopoSort.mm:11: In file included from /Users/bdoig/Dropbox/WData/TopoSort.h:20: /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:65:5: note: in instantiation of function template specialization 'boost::depth_first_search, boost::topo_sort_visitor > > >, boost::graph_visitor_t, boost::bgl_named_params >' requested here [2] depth_first_search(g, params.visitor(TopoVisitor(result))); ^ /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:71:5: note: in instantiation of function template specialization 'boost::topological_sort, std::front_insert_iterator > >, int, boost::buffer_param_t, boost::no_property>' requested here [2] topological_sort(g, result, ^ /Users/bdoig/Dropbox/WData/TopoSort.mm:20:3: note: in instantiation of function template specialization 'boost::topological_sort, std::front_insert_iterator > > >' requested here [2] boost::topological_sort(vectorList, std::front_inserter(topo_order)); ^ In file included from /Users/bdoig/Dropbox/WData/TopoSort.mm:11: In file included from /Users/bdoig/Dropbox/WData/TopoSort.h:20: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:16: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/depth_first_search.hpp:21: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/named_function_params.hpp:15: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/name.hpp:8: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/keyword.hpp:10: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/aux_/tag.hpp:8: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/aux_/tagged_argument.hpp:10: /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/aux_/arg_list.hpp:127:16:{127:16-127:23}: warning: reference to stack memory associated with local variable 'x' returned [2] return x.value; ^~~~~~~ In file included from /Users/bdoig/Dropbox/WData/TopoSort.mm:11: In file included from /Users/bdoig/Dropbox/WData/TopoSort.h:20: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:16: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/depth_first_search.hpp:21: /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/named_function_params.hpp:496:49: note: in instantiation of function template specialization 'boost::parameter::aux::empty_arg_list::operator[]' requested here [2] return helper::make_map(g, white_color, ap[boost::graph::keywords::_color_map | 0], ap); ^ In file included from /Users/bdoig/Dropbox/WData/TopoSort.mm:11: In file included from /Users/bdoig/Dropbox/WData/TopoSort.h:20: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:16: /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/depth_first_search.hpp:300:72: note: in instantiation of member function 'boost::detail::color_map_maker, boost::parameter::aux::arg_list > > > const>, boost::parameter::aux::arg_list, boost::parameter::aux::empty_arg_list> > >::make_map' requested here [2] boost::detail::color_map_maker::make_map(g, arg_pack), ^ In file included from /Users/bdoig/Dropbox/WData/TopoSort.mm:11: In file included from /Users/bdoig/Dropbox/WData/TopoSort.h:20: /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:65:5: note: in instantiation of function template specialization 'boost::depth_first_search, boost::topo_sort_visitor > > >, boost::graph_visitor_t, boost::bgl_named_params >' requested here [2] depth_first_search(g, params.visitor(TopoVisitor(result))); ^ /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:71:5: note: in instantiation of function template specialization 'boost::topological_sort, std::front_insert_iterator > >, int, boost::buffer_param_t, boost::no_property>' requested here [2] topological_sort(g, result, ^ /Users/bdoig/Dropbox/WData/TopoSort.mm:20:3: note: in instantiation of function template specialization 'boost::topological_sort, std::front_insert_iterator > > >' requested here [2] boost::topological_sort(vectorList, std::front_inserter(topo_order)); ^ In file included from /Users/bdoig/Dropbox/WData/TopoSort.mm:11: In file included from /Users/bdoig/Dropbox/WData/TopoSort.h:20: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:16: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/depth_first_search.hpp:21: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/named_function_params.hpp:15: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/name.hpp:8: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/keyword.hpp:10: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/aux_/tag.hpp:8: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/aux_/tagged_argument.hpp:10: /Users/bdoig/Documents/Projects/boost_1_43_0/boost/parameter/aux_/arg_list.hpp:127:16:{127:16-127:23}: warning: reference to stack memory associated with local variable 'x' returned [2] return x.value; ^~~~~~~ In file included from /Users/bdoig/Dropbox/WData/TopoSort.mm:11: In file included from /Users/bdoig/Dropbox/WData/TopoSort.h:20: In file included from /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:16: /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/depth_first_search.hpp:301:8: note: in instantiation of function template specialization 'boost::parameter::aux::empty_arg_list::operator[]' requested here [2] arg_pack[_root_vertex | *vertices(g).first] ^ In file included from /Users/bdoig/Dropbox/WData/TopoSort.mm:11: In file included from /Users/bdoig/Dropbox/WData/TopoSort.h:20: /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:65:5: note: in instantiation of function template specialization 'boost::depth_first_search, boost::topo_sort_visitor > > >, boost::graph_visitor_t, boost::bgl_named_params >' requested here [2] depth_first_search(g, params.visitor(TopoVisitor(result))); ^ /Users/bdoig/Documents/Projects/boost_1_43_0/boost/graph/topological_sort.hpp:71:5: note: in instantiation of function template specialization 'boost::topological_sort, std::front_insert_iterator > >, int, boost::buffer_param_t, boost::no_property>' requested here [2] topological_sort(g, result, ^ /Users/bdoig/Dropbox/WData/TopoSort.mm:20:3: note: in instantiation of function template specialization 'boost::topological_sort, std::front_insert_iterator > > >' requested here [2] boost::topological_sort(vectorList, std::front_inserter(topo_order)); ^ 3 warnings generated.",Bugs,new,Boost 1.44.0,parameter,Boost 1.44.0,Problem,,,