Undefined behavior in genautomata.c?
Richard Henderson
rth@redhat.com
Mon Sep 19 09:18:00 GMT 2005
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~
More information about the Gcc
mailing list