From 45b0c94cb45aefa68b1627f8a76a84bad2d5b717 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 7 Jun 2004 20:49:31 +0100 Subject: [PATCH] re PR c/14765 (ice-on-invalid-code, ICE while compiling ({}) expression) PR c/14765 * c-parse.in (compstmt_primary_start): Set last_expr_type to NULL_TREE. testsuite: * gcc.dg/pr14765-1.c: New test. From-SVN: r82713 --- gcc/ChangeLog | 6 ++++++ gcc/c-parse.in | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr14765-1.c | 11 +++++++++++ 4 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr14765-1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a277a4d9f9e..7a5323007be 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-06-07 Joseph S. Myers + + PR c/14765 + * c-parse.in (compstmt_primary_start): Set last_expr_type to + NULL_TREE. + 2004-06-07 Mark Mitchell PR c++/15815 diff --git a/gcc/c-parse.in b/gcc/c-parse.in index 9e776fa3e21..b89c19d80b6 100644 --- a/gcc/c-parse.in +++ b/gcc/c-parse.in @@ -2123,6 +2123,7 @@ compstmt_primary_start: keep_next_level (); compstmt_count++; $$ = add_stmt (build_stmt (COMPOUND_STMT, last_tree)); + last_expr_type = NULL_TREE; } ; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cbb0c496b23..bd4048b83d1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2004-06-07 Joseph S. Myers + + PR c/14765 + * gcc.dg/pr14765-1.c: New test. + 2004-06-07 Roger Sayle PR c/14649 diff --git a/gcc/testsuite/gcc.dg/pr14765-1.c b/gcc/testsuite/gcc.dg/pr14765-1.c new file mode 100644 index 00000000000..d2b341839ce --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr14765-1.c @@ -0,0 +1,11 @@ +/* Empty statement expressions should get void type. Bug 14765 from + Serge Belyshev . */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +int a; +void fun () +{ + a = 0; + a = ({}); /* { dg-error "not ignored" "void stmt expr" } */ +} -- 2.30.2