Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(570)

Issue 5536086: [pph] Fix ICE in build_int_cst_wide (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 3 months ago by Diego Novillo
Modified:
13 years, 1 month ago
Reviewers:
CC:
Lawrence Crowl, gcc-patches_gcc.gnu.org
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+24 lines, -2 lines) Patch
M gcc/cp/pph-in.c View 2 chunks +11 lines, -0 lines 0 comments Download
M gcc/cp/pph-out.c View 2 chunks +10 lines, -0 lines 0 comments Download
M gcc/testsuite/g++.dg/pph/x1namespace-alias2.cc View 1 chunk +3 lines, -2 lines 0 comments Download

Messages

Total messages: 1
Diego Novillo
13 years, 3 months ago (2012-01-21 00:30:27 UTC) #1
This patch fixes an ICE in build_int_cst_wide.  We were not writing
out TYPE_MODE for types, causing RTL generation to try to emit an
offset using VOIDmode.

This is not the only problem in this test case.  We are also failing
to mark something needed, because with PPH enabled, a whole function
is optimized out.  I'm not quite sure why yet.  I will fix this in a
subsequent patch.


2012-01-20   Diego Novillo  <dnovillo@google.com>

cp/ChangeLog.pph
	* pph-in.c (pph_in_machine_mode): New.
	(pph_in_tcc_type): Call it.
	* pph-out.c (pph_out_machine_mode): New.
	(pph_out_tcc_type): Call it.

testsuite/ChangeLog.pph
	* g++.dg/pph/x1namespace-alias2.cc: Remove expected ICE.
	Document assembly difference.

diff --git a/gcc/cp/pph-in.c b/gcc/cp/pph-in.c
index 0b2529f..5ee6458 100644
--- a/gcc/cp/pph-in.c
+++ b/gcc/cp/pph-in.c
@@ -1848,6 +1848,16 @@ pph_in_lang_type (pph_stream *stream)
 }
 
 
+/* Read from STREAM an enum machine_mode value.  */
+
+static enum machine_mode
+pph_in_machine_mode (pph_stream *stream)
+{
+  struct lto_input_block *ib = stream->encoder.r.ib;
+  return streamer_read_enum (ib, machine_mode, NUM_MACHINE_MODES);
+}
+
+
 /* Read from STREAM the body of tcc_type node TYPE.  */
 
 static void
@@ -1857,6 +1867,7 @@ pph_in_tcc_type (pph_stream *stream, tree type)
   TYPE_POINTER_TO (type) = pph_in_tree (stream);
   TYPE_REFERENCE_TO (type) = pph_in_tree (stream);
   TYPE_NEXT_VARIANT (type) = pph_in_tree (stream);
+  SET_TYPE_MODE (type, pph_in_machine_mode (stream));
   /* FIXME pph - Streaming TYPE_CANONICAL generates many type comparison
      failures.  Why?  */
   /* FIXME pph: apparently redundant.  */
diff --git a/gcc/cp/pph-out.c b/gcc/cp/pph-out.c
index 6e8eafd..1c055d9 100644
--- a/gcc/cp/pph-out.c
+++ b/gcc/cp/pph-out.c
@@ -1828,6 +1828,15 @@ pph_out_lang_type (pph_stream *stream, tree type)
     pph_out_lang_type_ptrmem (stream, &lt->u.ptrmem);
 }
 
+/* Write machine_mode value MODE to STREAM.  */
+
+static void
+pph_out_machine_mode (pph_stream *stream, enum machine_mode mode)
+{
+  struct output_block *ob = stream->encoder.w.ob;
+  streamer_write_enum (ob->main_stream, machine_mode, NUM_MACHINE_MODES, mode);
+}
+
 
 /* Write to STREAM the body of tcc_type node TYPE.  */
 
@@ -1838,6 +1847,7 @@ pph_out_tcc_type (pph_stream *stream, tree type)
   pph_out_tree (stream, TYPE_POINTER_TO (type));
   pph_out_tree (stream, TYPE_REFERENCE_TO (type));
   pph_out_tree (stream, TYPE_NEXT_VARIANT (type));
+  pph_out_machine_mode (stream, TYPE_MODE (type));
   /* FIXME pph - Streaming TYPE_CANONICAL generates many type comparison
      failures.  Why?  */
   pph_out_tree (stream, TREE_CHAIN (type));
diff --git a/gcc/testsuite/g++.dg/pph/x1namespace-alias2.cc
b/gcc/testsuite/g++.dg/pph/x1namespace-alias2.cc
index 9ba4c96..4dbe174 100644
--- a/gcc/testsuite/g++.dg/pph/x1namespace-alias2.cc
+++ b/gcc/testsuite/g++.dg/pph/x1namespace-alias2.cc
@@ -1,5 +1,6 @@
-// { dg-xfail-if "ICE build_int_cst_wide - bad merged type" { "*-*-*" } {
"-fpph-map=pph.map" } }
-// { dg-bogus "internal compiler error: in build_int_cst_wide, at tree.c" "" {
xfail *-*-* } 0 }
+// pph asm xdiff 34830
+// The assembly difference is due to missing code in function f().
+// The PPH version removes the whole return expression.
 #include "x1namespace-alias1.h"
 #include "x1namespace-alias2.h"
 

--
This patch is available for review at http://codereview.appspot.com/5536086
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b