diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | locale/loadlocale.c | 6 |
2 files changed, 10 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2017-10-27 Rafal Luzynski <digitalfreak@lingonborough.com> + + * locale/loadlocale.c: Correct size of + _nl_value_type_LC_<category> arrays. + 2017-10-27 Joseph Myers <joseph@codesourcery.com> * math/math.h [__HAVE_DISTINCT_FLOAT16 || (__HAVE_FLOAT16 && !_LIBC)]: diff --git a/locale/loadlocale.c b/locale/loadlocale.c index 2bdb39b4b8..2dba86d773 100644 --- a/locale/loadlocale.c +++ b/locale/loadlocale.c @@ -44,8 +44,12 @@ static const size_t _nl_category_num_items[] = #define NO_PAREN(arg, rest...) arg, ##rest +/* The size of the array must be specified explicitly because some of + the 'items' may be subarrays, which will cause the compiler to deduce + an incorrect size from the initializer. */ #define DEFINE_CATEGORY(category, category_name, items, a) \ -static const enum value_type _nl_value_type_##category[] = { NO_PAREN items }; +static const enum value_type _nl_value_type_##category \ + [_NL_ITEM_INDEX (_NL_NUM_##category)] = { NO_PAREN items }; #define DEFINE_ELEMENT(element, element_name, optstd, type, rest...) \ [_NL_ITEM_INDEX (element)] = type, #include "categories.def" |