Hi Bruno,

This is in the context of manywarnings, so I'll write to bug-gnulib,
of course, you're welcome to add bug-gettext, if desired.

I tried enabling -Wvla for coreutils and found that it provoked hundreds
of warnings, all due to this:

    ../lib/gettext.h:262:3: error: variable length array 'msg_ctxt_id'\
    is used [-Werror=vla]

That comes from this inline function from gettext.h:

    static const char *
    dcnpgettext_expr (const char *domain,
                      const char *msgctxt, const char *msgid,
                      const char *msgid_plural, unsigned long int n,
                      int category)
    {
      size_t msgctxt_len = strlen (msgctxt) + 1;
      size_t msgid_len = strlen (msgid) + 1;
      const char *translation;
    #if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
      char msg_ctxt_id[msgctxt_len + msgid_len];
    #else
    ...

Do we have a guarantee that that array dimension is reasonable?

Have you compared the trade-offs of VLA-vs-malloc here?

Reply via email to