From bfd3963ada85c08264a068e2dcff1d90b7325e3e Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Wed, 17 Dec 2008 07:53:51 +0000 Subject: [PATCH] Length 1 for global int x[]; is actually required by the standard! [r24739] --- parser.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/parser.c b/parser.c index 9fabfeb..8469447 100644 --- a/parser.c +++ b/parser.c @@ -5354,11 +5354,9 @@ static void check_variable_type_complete(entity_t *ent) if (!is_type_incomplete(type)) return; - /* GCC allows global arrays without size and assigns them a length of one, - * if no different declaration follows */ - if (is_type_array(type) && - c_mode & _GNUC && - ent->base.parent_scope == file_scope) { + /* §6.9.2:2 and §6.9.2:5: At the end of the translation incomplete arrays + * are given length one. */ + if (is_type_array(type) && ent->base.parent_scope == file_scope) { ARR_APP1(declaration_t*, incomplete_arrays, decl); return; } @@ -11360,8 +11358,8 @@ translation_unit_t *finish_parsing(void) return result; } -/* GCC allows global arrays without size and assigns them a length of one, - * if no different declaration follows */ +/* §6.9.2:2 and §6.9.2:5: At the end of the translation incomplete arrays + * are given length one. */ static void complete_incomplete_arrays(void) { size_t n = ARR_LEN(incomplete_arrays); -- 2.20.1