This patch fixes an ICE during gimplification.  When reading a
STATEMENT_LIST, we were calling append_to_statement_list, but at
that point some elements in the list do not have side-effects
(the final VAR_DECL in a stmt expression), so we were dropping it
out.

Fixed by force-adding every statetement we read.  This fixes
c1attr-warn-unused-result.cc.

Tested on x86_64.  Committed to branch.


        * pph-streamer-in.c (pph_read_tree): Call
        append_to_statement_list_force instead of append_to_statement_list.

testsuite/ChangeLog.pph

        * g++.dg/pph/c1attr-warn-unused-result.cc: Remove xfail marker.


diff --git a/gcc/cp/ChangeLog.pph b/gcc/cp/ChangeLog.pph
index c2679e6..a62dd66 100644
--- a/gcc/cp/ChangeLog.pph
+++ b/gcc/cp/ChangeLog.pph
@@ -1,3 +1,8 @@
+2011-06-29   Diego Novillo  <dnovi...@google.com>
+
+       * pph-streamer-in.c (pph_read_tree): Call
+       append_to_statement_list_force instead of append_to_statement_list.
+
 2011-06-28   Diego Novillo  <dnovi...@google.com>
 
        * pph-streamer-in.c (pph_in_ld_fn): Instantiate
diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index 1dabcf1..1a59640 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -1488,7 +1488,7 @@ pph_read_tree (struct lto_input_block *ib 
ATTRIBUTE_UNUSED,
         for (i = 0; i < num_trees; i++)
          {
            tree stmt = pph_in_tree (stream);
-           append_to_statement_list (stmt, &expr);
+           append_to_statement_list_force (stmt, &expr);
          }
       }
       break;
diff --git a/gcc/testsuite/ChangeLog.pph b/gcc/testsuite/ChangeLog.pph
index 9c33875..aeede51 100644
--- a/gcc/testsuite/ChangeLog.pph
+++ b/gcc/testsuite/ChangeLog.pph
@@ -1,3 +1,7 @@
+2011-06-29  Diego Novillo  <dnovi...@google.com>
+
+       * g++.dg/pph/c1attr-warn-unused-result.cc: Remove xfail marker.
+
 2011-06-28  Diego Novillo  <dnovi...@google.com>
 
        * g++.dg/pph/c1attr-warn-unused-result.cc: Expect an ICE.
diff --git a/gcc/testsuite/g++.dg/pph/c1attr-warn-unused-result.cc 
b/gcc/testsuite/g++.dg/pph/c1attr-warn-unused-result.cc
index 4633106..da75561 100644
--- a/gcc/testsuite/g++.dg/pph/c1attr-warn-unused-result.cc
+++ b/gcc/testsuite/g++.dg/pph/c1attr-warn-unused-result.cc
@@ -1,6 +1,3 @@
-/* { dg-xfail-if "ICE" { "*-*-*" } { "-fpph-map=pph.map" } } */
-// { dg-bogus "internal compiler error: Segmentation fault" "" { xfail *-*-* } 
0 }
-// { dg-prune-output "In file included from" }
 /* { dg-options "-w" } */
 // pph asm xdiff
 #include "c1attr-warn-unused-result.h"

--
This patch is available for review at http://codereview.appspot.com/4636074

Reply via email to