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]

[lto] Guard against mismatched LTO_DEBUG_STREAM settings


This patch prevents empty stream debugging sections from
confusing lto1.  I was running into this when debugging object
files generated with a cc1/cc1plus binary compiled with stream
debugging disabled.

Tested on x86.


Diego.



	* lto-section-in.c (lto_debug_in_fun): Guard against empty
	stream debug sections.

Index: lto-section-in.c
===================================================================
--- lto-section-in.c	(revision 141264)
+++ lto-section-in.c	(working copy)
@@ -604,6 +604,13 @@ lto_debug_in_fun (struct lto_debug_conte
   char b;
 
   stream = (struct lto_input_block *) context->current_data;
+
+  /* If the writer and reader were compiled with different settings
+     for LTO_STREAM_DEBUGGING, the debugging STREAM may not have any
+     data in it.  Do nothing in that case.  */
+  if (stream->len == 0 || stream->len == (unsigned) -1)
+    return;
+
   b = lto_input_1_unsigned (stream);
 
   if (b != c)


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