2019-08-26 09:17 CEST

View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0004861Spring engineGeneralpublic2015-06-30 20:19
Reportercleanrock 
Assigned Tohokomoko 
PrioritynormalSeveritymajorReproducibilityN/A
StatusresolvedResolutionfixed 
Product Version99.0+git 
Target Version100.0Fixed in Version 
Summary0004861: PushObjectDefProxyTable is broken
DescriptionThe sizeof use introduced in https://github.com/spring/spring/commit/a724aa9b4 do not work as intended:

In file included from /home/johanr/my_projects/spring/rts/Lua/LuaUnitDefs.cpp:19:0:
/home/johanr/my_projects/spring/rts/Lua/LuaUtils.h: In instantiation of ‘void PushObjectDefProxyTable(lua_State*, const char**, const char**, const IndexFuncType*, const IterFuncType*, const ObjectDefType*) [with ObjectDefType = UnitDef; IndexFuncType = int (*)(lua_State*); IterFuncType = int (*)(lua_State*); lua_State = lua_State]’:
/home/johanr/my_projects/spring/rts/Lua/LuaUnitDefs.cpp:104:77: required from here
/home/johanr/my_projects/spring/rts/Lua/LuaUtils.h:147:39: warning: ‘sizeof’ on array function parameter ‘indxFuncs’ will return size of ‘int (* const*)(lua_State*)’ [-Wsizeof-array-argument]
   for (unsigned int n = 0; n < (sizeof(indxFuncs) / sizeof(indxFuncs[0])); n++) {
                                       ^
/home/johanr/my_projects/spring/rts/Lua/LuaUtils.h:138:33: note: declared here
  const IndexFuncType indxFuncs[3],
                                 ^
/home/johanr/my_projects/spring/rts/Lua/LuaUtils.h:157:38: warning: ‘sizeof’ on array function parameter ‘iterFuncs’ will return size of ‘int (* const*)(lua_State*)’ [-Wsizeof-array-argument]
  for (unsigned int n = 0; n < (sizeof(iterFuncs) / sizeof(iterFuncs[0])); n++) {
                                      ^
/home/johanr/my_projects/spring/rts/Lua/LuaUtils.h:139:32: note: declared here
  const IterFuncType iterFuncs[2],


I have gcc 5.1.0.
I tested the above use of sizeof in a test app and indeed you will get the pointer size even if the array param have a specified size.
TagsNo tags attached.
Checked infolog.txt for lua Errors
Attached Files

-Relationships
+Relationships

-Notes

~0014805

cleanrock (developer)

abma, this is already fixed in https://github.com/spring/spring/commit/bdc2662f but i miss the changeset to link to this ticket, i think changeset importing is broken atm.

~0014806

hokomoko (developer)

it's now broken in the automatic builds and in gcc 4.9.2

~0014808

hokomoko (developer)

Fix ad377e4ccaeb29cee2ca48b8a47d92a464503305 committed to develop branch: Fix 0004861
HSTR_PUSH was used within a loop. since it uses a static const var, bad
things happened, repo: spring changeset id: 5275
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2015-06-30 07:47 cleanrock New Issue
2015-06-30 16:24 abma Product Version => 99.0+git
2015-06-30 16:24 abma Target Version => 100.0
2015-06-30 16:58 cleanrock Note Added: 0014805
2015-06-30 17:10 hokomoko Note Added: 0014806
2015-06-30 17:19 hokomoko Changeset attached => spring develop bdc2662f
2015-06-30 20:19 hokomoko Changeset attached => spring develop ad377e4c
2015-06-30 20:19 hokomoko Note Added: 0014808
2015-06-30 20:19 hokomoko Assigned To => hokomoko
2015-06-30 20:19 hokomoko Status new => resolved
2015-06-30 20:19 hokomoko Resolution open => fixed
+Issue History