osrm-backend icon indicating copy to clipboard operation
osrm-backend copied to clipboard

Outside array bounds error

Open kiufta opened this issue 3 years ago • 8 comments

I've just tried to compile git master under ArchLinux (gcc 12.2):

There is a build failure inside https://github.com/ThePhD/sol2 :

In file included from ./osrm-backend/include/extractor/scripting_environment_lua.hpp:15:
In member function 'void sol::stack::field_getter<T, global, raw, <template-parameter-1-4> >::get(lua_State*, Key&&, int) [with Key = const char (&)[23]; T = char [23]; bool global = false; bool raw = false; <template-parameter-1-4> = void]',
    inlined from 'void sol::stack::get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[23]]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12091:62,
    inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, <template-parameter-1-5> >::get(lua_State*, Key&&, int) [with Key = const char (&)[23]; T = char [23]; P = int; bool b = false; bool raw = false; <template-parameter-1-5> = void]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16328:21,
    inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, <template-parameter-1-5> >::get(lua_State*, Key&&, int) [with Key = const char (&)[15]; T = char [15]; P = int; bool b = false; bool raw = false; <template-parameter-1-5> = void]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16322:9,
    inlined from 'sol::stack::probe sol::stack::probe_get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; C = int; Key = const char (&)[15]]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12111:78,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional<int>; Key = const char (&)[15]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25612:62,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional<int>; Keys = {const char (&)[15]}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25518:83,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get(Keys&& ...) const [with T = sol::optional<int>; Keys = {const char (&)[15]}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25845:40,
    inlined from 'decltype(auto) sol::table_proxy< <template-parameter-1-1>, <template-parameter-1-2> >::tuple_get(std::index_sequence<Ix ...>) const & [with T = sol::optional<int>; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference<false> >&; Key = std::tuple<const char (&)[15]>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24727:39,
    inlined from 'decltype(auto) sol::table_proxy< <template-parameter-1-1>, <template-parameter-1-2> >::get() const & [with T = sol::optional<int>; Table = sol::basic_table_core<false, sol::basic_reference<false> >&; Key = std::tuple<const char (&)[15]>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24832:23,
    inlined from 'sol::proxy_base< <template-parameter-1-1> >::operator T() const [with T = sol::optional<int>; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char*>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list<char> >) || is_string_view_of_v<T, char>) || is_null_pointer_v<T>)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<_Up>::type>::type> >::value, sol::meta::enable_t>::type <anonymous> = sol::meta::enable_t::_; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference<false> >&, std::tuple<const char (&)[15]> >]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16972:32,
    inlined from 'osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>' at ./osrm-backend/src/extractor/scripting_environment_lua.cpp:588:85:
./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16151:61: warning: array subscript 'const char [23][0]' is partly outside array bounds of 'const char [15]' [-Warray-bounds]
16151 |                                                 lua_getfield(L, tableindex, &key[0]);
      |                                                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In member function 'void sol::stack::field_getter<T, global, raw, <template-parameter-1-4> >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; bool global = false; bool raw = false; <template-parameter-1-4> = void]',
    inlined from 'void sol::stack::get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[30]]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12091:62,
    inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, <template-parameter-1-5> >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; P = bool; bool b = false; bool raw = false; <template-parameter-1-5> = void]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16328:21,
    inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, <template-parameter-1-5> >::get(lua_State*, Key&&, int) [with Key = const char (&)[22]; T = char [22]; P = bool; bool b = false; bool raw = false; <template-parameter-1-5> = void]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16322:9,
    inlined from 'sol::stack::probe sol::stack::probe_get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; C = bool; Key = const char (&)[22]]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12111:78,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional<bool>; Key = const char (&)[22]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25612:62,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional<bool>; Keys = {const char (&)[22]}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25518:83,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get(Keys&& ...) const [with T = sol::optional<bool>; Keys = {const char (&)[22]}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25845:40,
    inlined from 'decltype(auto) sol::table_proxy< <template-parameter-1-1>, <template-parameter-1-2> >::tuple_get(std::index_sequence<Ix ...>) const & [with T = sol::optional<bool>; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference<false> >&; Key = std::tuple<const char (&)[22]>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24727:39,
    inlined from 'decltype(auto) sol::table_proxy< <template-parameter-1-1>, <template-parameter-1-2> >::get() const & [with T = sol::optional<bool>; Table = sol::basic_table_core<false, sol::basic_reference<false> >&; Key = std::tuple<const char (&)[22]>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24832:23,
    inlined from 'sol::proxy_base< <template-parameter-1-1> >::operator T() const [with T = sol::optional<bool>; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char*>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list<char> >) || is_string_view_of_v<T, char>) || is_null_pointer_v<T>)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<_Up>::type>::type> >::value, sol::meta::enable_t>::type <anonymous> = sol::meta::enable_t::_; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference<false> >&, std::tuple<const char (&)[22]> >]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16972:32,
    inlined from 'osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>' at ./osrm-backend/src/extractor/scripting_environment_lua.cpp:603:91:
./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16151:61: warning: array subscript 'const char [30][0]' is partly outside array bounds of 'const char [22]' [-Warray-bounds]
16151 |                                                 lua_getfield(L, tableindex, &key[0]);
      |                                                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In member function 'void sol::stack::field_getter<T, global, raw, <template-parameter-1-4> >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; bool global = false; bool raw = false; <template-parameter-1-4> = void]',
    inlined from 'void sol::stack::get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[30]]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12091:62,
    inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, <template-parameter-1-5> >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; P = bool; bool b = false; bool raw = false; <template-parameter-1-5> = void]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16328:21,
    inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, <template-parameter-1-5> >::get(lua_State*, Key&&, int) [with Key = const char (&)[18]; T = char [18]; P = bool; bool b = false; bool raw = false; <template-parameter-1-5> = void]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16322:9,
    inlined from 'sol::stack::probe sol::stack::probe_get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; C = bool; Key = const char (&)[18]]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12111:78,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional<bool>; Key = const char (&)[18]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25612:62,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional<bool>; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25518:83,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get(Keys&& ...) const [with T = sol::optional<bool>; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25845:40,
    inlined from 'decltype(auto) sol::table_proxy< <template-parameter-1-1>, <template-parameter-1-2> >::tuple_get(std::index_sequence<Ix ...>) const & [with T = sol::optional<bool>; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference<false> >&; Key = std::tuple<const char (&)[18]>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24727:39,
    inlined from 'decltype(auto) sol::table_proxy< <template-parameter-1-1>, <template-parameter-1-2> >::get() const & [with T = sol::optional<bool>; Table = sol::basic_table_core<false, sol::basic_reference<false> >&; Key = std::tuple<const char (&)[18]>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24832:23,
    inlined from 'sol::proxy_base< <template-parameter-1-1> >::operator T() const [with T = sol::optional<bool>; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char*>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list<char> >) || is_string_view_of_v<T, char>) || is_null_pointer_v<T>)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<_Up>::type>::type> >::value, sol::meta::enable_t>::type <anonymous> = sol::meta::enable_t::_; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference<false> >&, std::tuple<const char (&)[18]> >]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16972:32,
    inlined from 'osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>' at ./osrm-backend/src/extractor/scripting_environment_lua.cpp:607:83:
./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16151:61: warning: array subscript 'const char [30][0]' is partly outside array bounds of 'const char [18]' [-Warray-bounds]
16151 |                                                 lua_getfield(L, tableindex, &key[0]);
      |                                                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In member function 'void sol::stack::field_getter<T, global, raw, <template-parameter-1-4> >::get(lua_State*, Key&&, int) [with Key = const char (&)[23]; T = char [23]; bool global = false; bool raw = false; <template-parameter-1-4> = void]',
    inlined from 'void sol::stack::get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[23]]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12091:62,
    inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, <template-parameter-1-5> >::get(lua_State*, Key&&, int) [with Key = const char (&)[23]; T = char [23]; P = int; bool b = false; bool raw = false; <template-parameter-1-5> = void]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16328:21,
    inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, <template-parameter-1-5> >::get(lua_State*, Key&&, int) [with Key = const char (&)[17]; T = char [17]; P = unsigned int; bool b = false; bool raw = false; <template-parameter-1-5> = void]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16322:9,
    inlined from 'sol::stack::probe sol::stack::probe_get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; C = unsigned int; Key = const char (&)[17]]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12111:78,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional<unsigned int>; Key = const char (&)[17]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25612:62,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional<unsigned int>; Keys = {const char (&)[17]}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25518:83,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get(Keys&& ...) const [with T = sol::optional<unsigned int>; Keys = {const char (&)[17]}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25845:40,
    inlined from 'decltype(auto) sol::table_proxy< <template-parameter-1-1>, <template-parameter-1-2> >::tuple_get(std::index_sequence<Ix ...>) const & [with T = sol::optional<unsigned int>; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference<false> >&; Key = std::tuple<const char (&)[17]>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24727:39,
    inlined from 'decltype(auto) sol::table_proxy< <template-parameter-1-1>, <template-parameter-1-2> >::get() const & [with T = sol::optional<unsigned int>; Table = sol::basic_table_core<false, sol::basic_reference<false> >&; Key = std::tuple<const char (&)[17]>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24832:23,
    inlined from 'sol::proxy_base< <template-parameter-1-1> >::operator T() const [with T = sol::optional<unsigned int>; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char*>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list<char> >) || is_string_view_of_v<T, char>) || is_null_pointer_v<T>)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<_Up>::type>::type> >::value, sol::meta::enable_t>::type <anonymous> = sol::meta::enable_t::_; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference<false> >&, std::tuple<const char (&)[17]> >]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16972:32,
    inlined from 'osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>' at ./osrm-backend/src/extractor/scripting_environment_lua.cpp:611:85:
./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16151:61: warning: array subscript 'const char [23][0]' is partly outside array bounds of 'const char [17]' [-Warray-bounds]
16151 |                                                 lua_getfield(L, tableindex, &key[0]);
      |                                                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
In member function 'void sol::stack::field_getter<T, global, raw, <template-parameter-1-4> >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; bool global = false; bool raw = false; <template-parameter-1-4> = void]',
    inlined from 'void sol::stack::get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[30]]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12091:62,
    inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, <template-parameter-1-5> >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; P = bool; bool b = false; bool raw = false; <template-parameter-1-5> = void]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16328:21,
    inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, <template-parameter-1-5> >::get(lua_State*, Key&&, int) [with Key = const char (&)[18]; T = char [18]; P = bool; bool b = false; bool raw = false; <template-parameter-1-5> = void]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16322:9,
    inlined from 'sol::stack::probe sol::stack::probe_get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; C = bool; Key = const char (&)[18]]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12111:78,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional<bool>; Key = const char (&)[18]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25612:62,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional<bool>; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25518:83,
    inlined from 'decltype(auto) sol::basic_table_core<<anonymous>, <template-parameter-1-2> >::traverse_get(Keys&& ...) const [with T = sol::optional<bool>; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference<false>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25845:40,
    inlined from 'decltype(auto) sol::table_proxy< <template-parameter-1-1>, <template-parameter-1-2> >::tuple_get(std::index_sequence<Ix ...>) const & [with T = sol::optional<bool>; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference<false> >&; Key = std::tuple<const char (&)[18]>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24727:39,
    inlined from 'decltype(auto) sol::table_proxy< <template-parameter-1-1>, <template-parameter-1-2> >::get() const & [with T = sol::optional<bool>; Table = sol::basic_table_core<false, sol::basic_reference<false> >&; Key = std::tuple<const char (&)[18]>]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24832:23,
    inlined from 'sol::proxy_base< <template-parameter-1-1> >::operator T() const [with T = sol::optional<bool>; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char*>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list<char> >) || is_string_view_of_v<T, char>) || is_null_pointer_v<T>)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<_Up>::type>::type> >::value, sol::meta::enable_t>::type <anonymous> = sol::meta::enable_t::_; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference<false> >&, std::tuple<const char (&)[18]> >]' at ./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16972:32,
    inlined from 'osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>' at ./osrm-backend/src/extractor/scripting_environment_lua.cpp:615:83:
./osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16151:61: warning: array subscript 'const char [30][0]' is partly outside array bounds of 'const char [18]' [-Warray-bounds]
16151 |                                                 lua_getfield(L, tableindex, &key[0]);
      |                                                 ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
make[2]: Leaving directory './osrm-backend/build'
[ 96%] Built target EXTRACTOR
make[1]: Leaving directory './osrm-backend/build'
make: *** [Makefile:156: all] Error 2

kiufta avatar Aug 30 '22 13:08 kiufta

@kiufta are you sure it is inside sol2? I see only warnings from there and no error message.

SiarheiFedartsou avatar Aug 30 '22 20:08 SiarheiFedartsou

Today I tried to build git master under latest Arch Linux and got the same build failure.

The build only failed when I set CMAKE_BUILD_TYPE=Release according to instructions at https://github.com/Project-OSRM/osrm-backend/wiki/Building-OSRM. It looks like this build type causes compiler warnings to be treated as errors and this is why the warnings mentioned above caused the build to fail. At first I tried to build git master without setting CMAKE_BUILD_TYPE and that succeeded.

Used compiler version: gcc (GCC) 12.2.1 20230201

Received console output:

In file included from /home/lliehu/git/osrm-backend/include/extractor/scripting_environment_lua.hpp:15, from /home/lliehu/git/osrm-backend/src/extractor/scripting_environment_lua.cpp:1: In member function 'void sol::stack::field_getter<T, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[23]; T = char [23]; bool global = false; bool raw = false; = void]', inlined from 'void sol::stack::get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[23]]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12091:62, inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[23]; T = char [23]; P = int; bool b = false; bool raw = false; = void]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16328:21, inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[15]; T = char [15]; P = int; bool b = false; bool raw = false; = void]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16322:9, inlined from 'sol::stack::probe sol::stack::probe_get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; C = int; Key = const char (&)[15]]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12111:78, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional; Key = const char (&)[15]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25612:62, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional; Keys = {const char (&)[15]}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25518:83, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get(Keys&& ...) const [with T = sol::optional; Keys = {const char (&)[15]}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25845:40, inlined from 'decltype(auto) sol::table_proxy< , >::tuple_get(std::index_sequence<Ix ...>) const & [with T = sol::optional; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[15]>]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24727:39, inlined from 'decltype(auto) sol::table_proxy< , >::get() const & [with T = sol::optional; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[15]>]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24832:23, inlined from 'sol::proxy_base< >::operator T() const [with T = sol::optional; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char*>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list >) || is_string_view_of_v<T, char>) || is_null_pointer_v<T>)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<Up>::type>::type> >::value, sol::meta::enable_t>::type = sol::meta::enable_t::; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference >&, std::tuple<const char (&)[15]> >]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16972:32, inlined from 'osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>' at /home/lliehu/git/osrm-backend/src/extractor/scripting_environment_lua.cpp:605:85: /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16151:61: error: array subscript 'const char [23][0]' is partly outside array bounds of 'const char [15]' [-Werror=array-bounds] 16151 | lua_getfield(L, tableindex, &key[0]); | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ In member function 'void sol::stack::field_getter<T, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; bool global = false; bool raw = false; = void]', inlined from 'void sol::stack::get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[30]]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12091:62, inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; P = bool; bool b = false; bool raw = false; = void]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16328:21, inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[22]; T = char [22]; P = bool; bool b = false; bool raw = false; = void]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16322:9, inlined from 'sol::stack::probe sol::stack::probe_get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; C = bool; Key = const char (&)[22]]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12111:78, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional; Key = const char (&)[22]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25612:62, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional; Keys = {const char (&)[22]}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25518:83, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get(Keys&& ...) const [with T = sol::optional; Keys = {const char (&)[22]}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25845:40, inlined from 'decltype(auto) sol::table_proxy< , >::tuple_get(std::index_sequence<Ix ...>) const & [with T = sol::optional; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[22]>]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24727:39, inlined from 'decltype(auto) sol::table_proxy< , >::get() const & [with T = sol::optional; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[22]>]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24832:23, inlined from 'sol::proxy_base< >::operator T() const [with T = sol::optional; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char*>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list >) || is_string_view_of_v<T, char>) || is_null_pointer_v<T>)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<Up>::type>::type> >::value, sol::meta::enable_t>::type = sol::meta::enable_t::; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference >&, std::tuple<const char (&)[22]> >]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16972:32, inlined from 'osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>' at /home/lliehu/git/osrm-backend/src/extractor/scripting_environment_lua.cpp:620:91: /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16151:61: error: array subscript 'const char [30][0]' is partly outside array bounds of 'const char [22]' [-Werror=array-bounds] 16151 | lua_getfield(L, tableindex, &key[0]); | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ In member function 'void sol::stack::field_getter<T, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; bool global = false; bool raw = false; = void]', inlined from 'void sol::stack::get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[30]]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12091:62, inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; P = bool; bool b = false; bool raw = false; = void]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16328:21, inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[18]; T = char [18]; P = bool; bool b = false; bool raw = false; = void]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16322:9, inlined from 'sol::stack::probe sol::stack::probe_get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; C = bool; Key = const char (&)[18]]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12111:78, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional; Key = const char (&)[18]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25612:62, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25518:83, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get(Keys&& ...) const [with T = sol::optional; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25845:40, inlined from 'decltype(auto) sol::table_proxy< , >::tuple_get(std::index_sequence<Ix ...>) const & [with T = sol::optional; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[18]>]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24727:39, inlined from 'decltype(auto) sol::table_proxy< , >::get() const & [with T = sol::optional; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[18]>]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24832:23, inlined from 'sol::proxy_base< >::operator T() const [with T = sol::optional; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char*>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list >) || is_string_view_of_v<T, char>) || is_null_pointer_v<T>)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<Up>::type>::type> >::value, sol::meta::enable_t>::type = sol::meta::enable_t::; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference >&, std::tuple<const char (&)[18]> >]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16972:32, inlined from 'osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>' at /home/lliehu/git/osrm-backend/src/extractor/scripting_environment_lua.cpp:624:83: /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16151:61: error: array subscript 'const char [30][0]' is partly outside array bounds of 'const char [18]' [-Werror=array-bounds] 16151 | lua_getfield(L, tableindex, &key[0]); | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ In member function 'void sol::stack::field_getter<T, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[23]; T = char [23]; bool global = false; bool raw = false; = void]', inlined from 'void sol::stack::get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[23]]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12091:62, inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[23]; T = char [23]; P = int; bool b = false; bool raw = false; = void]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16328:21, inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[17]; T = char [17]; P = unsigned int; bool b = false; bool raw = false; = void]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16322:9, inlined from 'sol::stack::probe sol::stack::probe_get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; C = unsigned int; Key = const char (&)[17]]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12111:78, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional; Key = const char (&)[17]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25612:62, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional; Keys = {const char (&)[17]}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25518:83, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get(Keys&& ...) const [with T = sol::optional; Keys = {const char (&)[17]}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25845:40, inlined from 'decltype(auto) sol::table_proxy< , >::tuple_get(std::index_sequence<Ix ...>) const & [with T = sol::optional; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[17]>]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24727:39, inlined from 'decltype(auto) sol::table_proxy< , >::get() const & [with T = sol::optional; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[17]>]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24832:23, inlined from 'sol::proxy_base< >::operator T() const [with T = sol::optional; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char*>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list >) || is_string_view_of_v<T, char>) || is_null_pointer_v<T>)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<Up>::type>::type> >::value, sol::meta::enable_t>::type = sol::meta::enable_t::; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference >&, std::tuple<const char (&)[17]> >]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16972:32, inlined from 'osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>' at /home/lliehu/git/osrm-backend/src/extractor/scripting_environment_lua.cpp:628:85: /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16151:61: error: array subscript 'const char [23][0]' is partly outside array bounds of 'const char [17]' [-Werror=array-bounds] 16151 | lua_getfield(L, tableindex, &key[0]); | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ In member function 'void sol::stack::field_getter<T, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; bool global = false; bool raw = false; = void]', inlined from 'void sol::stack::get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; Key = const char (&)[30]]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12091:62, inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[30]; T = char [30]; P = bool; bool b = false; bool raw = false; = void]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16328:21, inlined from 'sol::stack::probe sol::stack::probe_field_getter<T, P, global, raw, >::get(lua_State*, Key&&, int) [with Key = const char (&)[18]; T = char [18]; P = bool; bool b = false; bool raw = false; = void]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16322:9, inlined from 'sol::stack::probe sol::stack::probe_get_field(lua_State*, Key&&, int) [with bool global = false; bool raw = false; C = bool; Key = const char (&)[18]]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:12111:78, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get_deep_optional(int&, int, Key&&, Keys&& ...) const [with bool global = false; bool raw = false; sol::detail::insert_mode mode = sol::detail::none; T = sol::optional; Key = const char (&)[18]; Keys = {}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25612:62, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get_single(int, Keys&& ...) const [with bool raw = false; Ret = sol::optional; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25518:83, inlined from 'decltype(auto) sol::basic_table_core<, >::traverse_get(Keys&& ...) const [with T = sol::optional; Keys = {const char (&)[18]}; bool top_level = false; ref_t = sol::basic_reference]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:25845:40, inlined from 'decltype(auto) sol::table_proxy< , >::tuple_get(std::index_sequence<Ix ...>) const & [with T = sol::optional; long unsigned int ...I = {0}; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[18]>]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24727:39, inlined from 'decltype(auto) sol::table_proxy< , >::get() const & [with T = sol::optional; Table = sol::basic_table_core<false, sol::basic_reference >&; Key = std::tuple<const char (&)[18]>]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:24832:23, inlined from 'sol::proxy_base< >::operator T() const [with T = sol::optional; typename std::enable_if<sol::meta::all<std::integral_constant<bool, (! std::integral_constant<bool, ((((((is_string_literal_array_of_v<T, char> || is_same_v<T, const char*>) || is_same_v<T, char>) || is_string_of_v<T, char>) || is_same_v<T, std::initializer_list >) || is_string_view_of_v<T, char>) || is_null_pointer_v<T>)>::value)>, sol::is_proxy_primitive<typename std::remove_cv<typename std::remove_reference<Up>::type>::type> >::value, sol::meta::enable_t>::type = sol::meta::enable_t::; Super = sol::table_proxy<sol::basic_table_core<false, sol::basic_reference >&, std::tuple<const char (&)[18]> >]' at /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16972:32, inlined from 'osrm::extractor::Sol2ScriptingEnvironment::InitContext(osrm::extractor::LuaScriptingContext&)::<lambda()>' at /home/lliehu/git/osrm-backend/src/extractor/scripting_environment_lua.cpp:632:83: /home/lliehu/git/osrm-backend/third_party/sol2-3.3.0/include/sol/sol.hpp:16151:61: error: array subscript 'const char [30][0]' is partly outside array bounds of 'const char [18]' [-Werror=array-bounds] 16151 | lua_getfield(L, tableindex, &key[0]); | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ At global scope: cc1plus: note: unrecognized command-line option '-Wno-shorten-64-to-32' may have been intended to silence earlier diagnostics cc1plus: note: unrecognized command-line option '-Wno-unused-member-function' may have been intended to silence earlier diagnostics cc1plus: note: unrecognized command-line option '-Wno-implicit-float-conversion' may have been intended to silence earlier diagnostics cc1plus: note: unrecognized command-line option '-Wno-implicit-int-conversion' may have been intended to silence earlier diagnostics cc1plus: all warnings being treated as errors make[2]: *** [CMakeFiles/EXTRACTOR.dir/build.make:328: CMakeFiles/EXTRACTOR.dir/src/extractor/scripting_environment_lua.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:236: CMakeFiles/EXTRACTOR.dir/all] Error 2 make: *** [Makefile:156: all] Error 2

lliehu avatar Apr 19 '23 09:04 lliehu

I had the error even when I didn't specify CMAKE_BUILD_TYPE=Release. I tried compiling with gcc 12.2 on Ubuntu 22.04 and 22.10, it finally worked when I downgraded to gcc 11.3.

nik498 avatar May 17 '23 18:05 nik498

Can reproduce on Debian Bookworm.

The build only failed when I set CMAKE_BUILD_TYPE=Release according to instructions at https://github.com/Project-OSRM/osrm-backend/wiki/Building-OSRM. It looks like this build type causes compiler warnings to be treated as errors and this is why the warnings mentioned above caused the build to fail. At first I tried to build git master without setting

I do not think this is the case. Using build type Debug does not even produce the warning. Maybe its an issue with compiler optimization itself.

tillschaefer avatar May 26 '23 17:05 tillschaefer

I do not think this is the case. Using build type Debug does not even produce the warning. Maybe its an issue with compiler optimization itself.

Good point. Didn't think to check that. Now was able to make the warning go away just by switching optimization level from Release default -O3 to -Og.

lliehu avatar May 27 '23 23:05 lliehu

On CI we just turn this warning off for gcc 12 https://github.com/Project-OSRM/osrm-backend/blob/0ca913132acea46e0c56e4665af50d68f53eec68/.github/workflows/osrm-backend.yml#L224

SiarheiFedartsou avatar May 28 '23 06:05 SiarheiFedartsou

fyi

  • the -Wuninitialized errors should be gone with boost >= 1.80, see https://github.com/boostorg/function/commit/5b4e2797a28f9477d2df5fa915409dac73ff00c6
  • the -Werror=array-bounds of sol2-3.3.0 can be fixed by lowering the optimization level to -O2

tillschaefer avatar May 31 '23 11:05 tillschaefer

In case you are not a cmake user and just want to compile in release mode (like me)

cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-Wno-array-bounds -Wno-uninitialized"

will do the trick (tested with Debian 12.1 and OSRM release 5.27.1).

In reference to Building OSRM.

RhinoDevel avatar Aug 21 '23 10:08 RhinoDevel

This issue seems to be stale. It will be closed in 30 days if no further activity occurs.

github-actions[bot] avatar Jul 08 '24 20:07 github-actions[bot]