diff mbox

[pph] Fix many segmentation faults when restoring C++ ASTs (issue4441070)

Message ID 20110426234411.654331DA1C2@topo.tor.corp.google.com
State New
Headers show

Commit Message

Diego Novillo April 26, 2011, 11:44 p.m. UTC
I have been testing the C++ streamer with a collection of 6,576
C test cases taken from the GCC testsuite.

These C programs build fine with g++, so I encapsulated them inside a
single header file and created a .cc file that simply #includes it.

The intent is to make sure we can PPH generate and read a single
header file.  

Before this patch, we were failing to build about 1,800 test cases.
Most of those failures were due to the streamer reading an LTO tag for
a language-specific code and confusing it with a decl reference.  This
was happening because LTO tag codes were overlapping with language
specific tree codes.

With this patch the number of failures goes from 1,800 to 146.

I will be adding a .exp file to the testsuite in a future patch.
Right now, I'm testing this from a shell script.

Tested on x86_64.  Committed to the branch.


Diego.

ChangeLog.pph
2011-04-26  Diego Novillo  <dnovillo@google.com>

	* lto-streamer.h (enum LTO_tags): Change LTO_bb0 to begin
	after MAX_TREE_CODES.


--
This patch is available for review at http://codereview.appspot.com/4441070
diff mbox

Patch

diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h
index 8d5b1d2..b6f4b79 100644
--- a/gcc/lto-streamer.h
+++ b/gcc/lto-streamer.h
@@ -268,7 +268,7 @@  enum LTO_tags
 
      Conversely, to map between LTO tags and tree/gimple codes, the
      reverse operation must be applied.  */
-  LTO_bb0 = 1 + NUM_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE,
+  LTO_bb0 = 1 + MAX_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE,
   LTO_bb1,
 
   /* EH region holding the previous statement.  */