From fba78abb53543eacccb19dd42429dcd889fe21a9 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 10 Feb 2002 18:28:00 -0800 Subject: [PATCH] re PR c/5623 (GCC 3.0.3 crashes when assigning pointer to an array of undefined size which is member of a struct) PR c/5623 * c-typeck.c (incomplete_type_error): Handle flexible array members. From-SVN: r49663 --- gcc/ChangeLog | 5 +++++ gcc/c-typeck.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 35a872893bb..790bc10edb2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-02-10 Richard Henderson + + PR c/5623 + * c-typeck.c (incomplete_type_error): Handle flexible array members. + 2002-02-10 Richard Henderson PR c++/5624 diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index dc844bfb7a3..5d5b5f97870 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -149,6 +149,11 @@ incomplete_type_error (value, type) case ARRAY_TYPE: if (TYPE_DOMAIN (type)) { + if (TYPE_MAX_VALUE (TYPE_DOMAIN (type)) == NULL) + { + error ("invalid use of flexible array member"); + return; + } type = TREE_TYPE (type); goto retry; }