re PR c/14765 (ice-on-invalid-code, ICE while compiling ({}) expression)
authorJoseph Myers <jsm@polyomino.org.uk>
Mon, 7 Jun 2004 19:49:31 +0000 (20:49 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Mon, 7 Jun 2004 19:49:31 +0000 (20:49 +0100)
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
gcc/c-parse.in
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr14765-1.c [new file with mode: 0644]

index a277a4d9f9ee463b49d2ef81b72de2cdabba2c21..7a5323007bee8634caef1533ef90a64847941411 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-07  Joseph S. Myers  <jsm@polyomino.org.uk>
+
+       PR c/14765
+       * c-parse.in (compstmt_primary_start): Set last_expr_type to
+       NULL_TREE.
+
 2004-06-07  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/15815
index 9e776fa3e21a1f7d77901cd5783883cb80a049bc..b89c19d80b61a80169c724eaecc975cf2dc179db 100644 (file)
@@ -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;
                }
         ;
 
index cbb0c496b23fe5988adc340aae8e3e4569c3b8bc..bd4048b83d18fbef29f9e0b5d37feda0d197acea 100644 (file)
@@ -1,3 +1,8 @@
+2004-06-07  Joseph S. Myers  <jsm@polyomino.org.uk>
+
+       PR c/14765
+       * gcc.dg/pr14765-1.c: New test.
+
 2004-06-07  Roger Sayle  <roger@eyesopen.com>
 
        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 (file)
index 0000000..d2b3418
--- /dev/null
@@ -0,0 +1,11 @@
+/* Empty statement expressions should get void type.  Bug 14765 from
+   Serge Belyshev <belyshev@lubercy.com>.  */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int a;
+void fun ()
+{
+       a = 0;
+       a = ({}); /* { dg-error "not ignored" "void stmt expr" } */
+}