diff options
author | Marek Polacek <polacek@redhat.com> | 2013-12-03 11:57:31 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2013-12-03 11:57:31 +0000 |
commit | da0fc4547a3377430cbc522c4676cd1f707f32d2 (patch) | |
tree | 91085ec52c0073bd8c0dcaca52eb9f01e822159a /gcc/c | |
parent | 199f847c9819b6cb2c36f109e53d1ef0ad8ace83 (diff) | |
download | gcc-da0fc4547a3377430cbc522c4676cd1f707f32d2.zip gcc-da0fc4547a3377430cbc522c4676cd1f707f32d2.tar.gz gcc-da0fc4547a3377430cbc522c4676cd1f707f32d2.tar.bz2 |
re PR c/59351 (ICE on empty compound literal with -pedantic)
PR c/59351
c/
* c-decl.c (build_compound_literal): Allow compound literals with
empty initial value.
testsuite/
* gcc.dg/pr59351.c: New test.
From-SVN: r205627
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 42b0bb7..b97e65e 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2013-12-03 Marek Polacek <polacek@redhat.com> + + PR c/59351 + * c-decl.c (build_compound_literal): Allow compound literals with + empty initial value. + 2013-12-02 Joseph Myers <joseph@codesourcery.com> PR c/58235 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 27be7fc..3ebc002 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4693,7 +4693,9 @@ build_compound_literal (location_t loc, tree type, tree init, bool non_const) { int failure = complete_array_type (&TREE_TYPE (decl), DECL_INITIAL (decl), true); - gcc_assert (!failure); + /* If complete_array_type returns 3, it means that the + initial value of the compound literal is empty. Allow it. */ + gcc_assert (failure == 0 || failure == 3); type = TREE_TYPE (decl); TREE_TYPE (DECL_INITIAL (decl)) = type; |