------- Comment #3 from rguenth at gcc dot gnu dot org  2008-11-15 20:40 -------
Note that ...

struct dictitem_S
{
    typval_T    di_tv;          /* type and value of the variable */
    char_u      di_flags;       /* flags (only used for variable) */
    char_u      di_key[1];      /* key (actually longer!) */

};

  227     struct                      /* fixed variables for arguments */
  228     {
  229         dictitem_T      var;            /* variable (without
room for name) */
  230         char_u  room[VAR_SHORT_LEN];    /* room for the name */
  231     } fixvar[FIXVAR_CNT];


room makes fixvar[].var.di_key no longer a tra iling array.  Crossing objects
from di_key to room is not allowed by the C standard.  You may instead want
to do

union
{
  dictitem_t var;
  char_u  room[sizeof(dictitem_t) + VAR_SHORT_LEN];
} fixvar[FIXVAR_CNT];

which should be valid (I might have to doubl-check the standard though).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38136

Reply via email to