diff options
author | Marek Polacek <polacek@redhat.com> | 2016-05-02 11:35:59 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2016-05-02 11:35:59 +0000 |
commit | 7176a4a096decd4a1930e4bd84f8ba2f05f13f81 (patch) | |
tree | 35a0e8abb5a8e8d2be7b121522b7e42d4882c44f /gcc/c | |
parent | b5a5ade831991092d753d233cb2ac290d2db61cf (diff) | |
download | gcc-7176a4a096decd4a1930e4bd84f8ba2f05f13f81.zip gcc-7176a4a096decd4a1930e4bd84f8ba2f05f13f81.tar.gz gcc-7176a4a096decd4a1930e4bd84f8ba2f05f13f81.tar.bz2 |
re PR c/70851 (internal compiler error: in create_tmp_var, at gimple-expr.c:473)
PR c/70851
* c-decl.c (grokdeclarator): Diagnose when array's size has an
incomplete type.
* gcc.dg/enum-incomplete-3.c: New test.
From-SVN: r235750
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 15 |
2 files changed, 19 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index f02fbdb..793186b 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2016-05-02 Marek Polacek <polacek@redhat.com> + + PR c/70851 + * c-decl.c (grokdeclarator): Diagnose when array's size has an + incomplete type. + 2016-04-29 Cesar Philippidis <cesar@codesourcery.com> PR middle-end/70626 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 16e4250..7094efc 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -5799,10 +5799,21 @@ grokdeclarator (const struct c_declarator *declarator, { if (name) error_at (loc, "size of array %qE has non-integer type", - name); + name); else error_at (loc, - "size of unnamed array has non-integer type"); + "size of unnamed array has non-integer type"); + size = integer_one_node; + } + /* This can happen with enum forward declaration. */ + else if (!COMPLETE_TYPE_P (TREE_TYPE (size))) + { + if (name) + error_at (loc, "size of array %qE has incomplete type", + name); + else + error_at (loc, "size of unnamed array has incomplete " + "type"); size = integer_one_node; } |