Follow-up Comment #2, bug #18481 (project freeciv):

It does not make the warning go away. The attached diff does, however I have
no idea what consequences it might have. I don't use LUA, I can't really test
it.

You split this bug report in two, however the following is relevant to both
of them:

cc1: warnings being treated as errors
ruleset.c: In function 'load_ruleset_game':
ruleset.c:3231: warning: cast increases required alignment of target type

And ruleset.c:3231 is:

   3230   food_ini = secfile_lookup_int_vec(file, (size_t *)
   3231                                     &game.info.granary_num_inis,
   3232                                     "civstyle.granary_food_ini");

secfile_lookup_int_vec, where the bus error occurs.

The attached diff makes the warnings go away, but not the problem. I believe
the "patched" lua code will produce more bus errors, regardless of the type
the pointers are cast to. The solution to this is make a temporary variable,
and copy stuff to it. That way it will be aligned. If not that, then add some
__alignment__ (8) attribute to that LUA struct.

Here is a relevant document:
http://cmynhier.blogspot.com/2008/10/memory-alignment-on-sparc-or-300x.html

(file #13833)
    _______________________________________________________

Additional Item Attachment:

File name: fc.diff                        Size:1 KB


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?18481>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to