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]

[PATCH] Fix PR44196


We end up with unvisited types for free-lang-data in BLOCK trees
that we only reach through abstract origins.

So we should play safe and also visit BLOCKs and their vars
(or maybe scrap all vars from a function-decl without a
gimple body but a BLOCK tree).

For now retain as much information as we can (until we work
on proper debug info abstraction).

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2010-05-19  Richard Guenther  <rguenther@suse.de>

	PR lto/44196
	* tree.c (find_decls_types_r): Walk BLOCKs and its vars.

	* g++.dg/lto/20100519-1_0.C: New testcase.

Index: gcc/tree.c
===================================================================
*** gcc/tree.c	(revision 159559)
--- gcc/tree.c	(working copy)
*************** find_decls_types_r (tree *tp, int *ws, v
*** 4713,4718 ****
--- 4713,4727 ----
        fld_worklist_push (TREE_CHAIN (t), fld);
        *ws = 0;
      }
+   else if (TREE_CODE (t) == BLOCK)
+     {
+       tree tem;
+       for (tem = BLOCK_VARS (t); tem; tem = TREE_CHAIN (tem))
+ 	fld_worklist_push (tem, fld);
+       for (tem = BLOCK_SUBBLOCKS (t); tem; tem = BLOCK_CHAIN (tem))
+ 	fld_worklist_push (tem, fld);
+       fld_worklist_push (BLOCK_ABSTRACT_ORIGIN (t), fld);
+     }
  
    fld_worklist_push (TREE_TYPE (t), fld);
  
Index: gcc/testsuite/g++.dg/lto/20100519-1_0.C
===================================================================
*** gcc/testsuite/g++.dg/lto/20100519-1_0.C	(revision 0)
--- gcc/testsuite/g++.dg/lto/20100519-1_0.C	(revision 0)
***************
*** 0 ****
--- 1,23 ----
+ // { dg-lto-do link }
+ 
+ template <typename Ordinal>
+ struct DirectSerializationTraits
+ {
+   static void fromCountToDirectBytes(const Ordinal count) {}
+ };
+ template<typename Ordinal> class SerializationTraits
+   : public DirectSerializationTraits<Ordinal> { };
+ template <typename Ordinal>
+ class ConstValueTypeSerializationBuffer
+ {
+ public:
+     ConstValueTypeSerializationBuffer(const Ordinal count)
+       {
+ 	typedef SerializationTraits<Ordinal> SerT;
+ 	SerT::fromCountToDirectBytes(count);
+       }
+ };
+ int main ()
+ {
+   ConstValueTypeSerializationBuffer<int> charSendBuffer(1);
+ }


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