This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Undefined behavior in genautomata.c?


On Mon, Sep 19, 2005 at 11:14:20AM +0200, Sebastian Pop wrote:
> +      The fix is to declare this array as dynamically allocated as:
> + 
> +      decl_t *decls;
> + 
> +      then dynamically allocate its elements.  */
>     decl_t decls [1];

No, the fix is

#ifdef HAVE_FLEXIBLE_ARRAY_MEMBERS
  decl_t decls[];
#else
  decl_t decls[1];
#endif

Where

/* 1 if we have C99 flexible array members.  */
#if !defined(HAVE_DESIGNATED_INITIALIZERS)
#define HAVE_DESIGNATED_INITIALIZERS \
  ((GCC_VERSION >= XXX) || (__STDC_VERSION__ >= 199901L))
#endif

where XXX ought to be looked up; 3.2 or 3.3 is probably right.



r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]