This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[pph] Detect state mutation in DECLs/TYPEs [7/8] (issue5177042)


Another fixlet.  All the pph cache lookup routines accept NULL index
pointers when the caller does not care for them.  So should
pph_get_marker_for.

	* pph-streamer-in.c (pph_read_namespace_tree): Initialize EXPR.
 	* pph-streamer-out.c (pph_get_marker_for): Handle NULL values
	for INCLUDE_IX_P and IX_P.

diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index 3cbe168..a2bad3d 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -2098,7 +2098,7 @@ pph_read_namespace_tree (pph_stream *stream, tree enclosing_namespace)
 {
   struct lto_input_block *ib = stream->encoder.r.ib;
   struct data_in *data_in = stream->encoder.r.data_in;
-  tree expr;
+  tree expr = NULL_TREE;
   enum pph_record_marker marker;
   unsigned image_ix, ix;
   enum LTO_tags tag;
diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c
index f46c849..516eabb 100644
--- a/gcc/cp/pph-streamer-out.c
+++ b/gcc/cp/pph-streamer-out.c
@@ -239,8 +239,11 @@ static enum pph_record_marker
 pph_get_marker_for (pph_stream *stream, void *data, unsigned *include_ix_p,
                     unsigned *ix_p)
 {
-  *ix_p = -1u;
-  *include_ix_p = -1u;
+  if (ix_p)
+    *ix_p = -1u;
+
+  if (include_ix_p)
+    *include_ix_p = -1u;
 
   /* We represent NULL pointers with PPH_RECORD_END.  */
   if (data == NULL)
-- 
1.7.3.1


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]