Skip to content

Commit 47ecee1

Browse files
committed
c++, contracts: Ensure we remove contracts before LTO streaming.
LTO does not (and should not) understand Front End trees .. but we were leaking them via the FUNCTION_DECL attributes. Once we have finished code-gen they are done with. Remove contracts in cp_free_lang_data, which is called right before the LTO stream out. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
1 parent a44feeb commit 47ecee1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gcc/cp/tree.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
3636
#include "attribs.h"
3737
#include "flags.h"
3838
#include "selftest.h"
39+
#include "contracts.h"
3940

4041
static tree bot_manip (tree *, int *, void *);
4142
static tree bot_replace (tree *, int *, void *);
@@ -6354,6 +6355,10 @@ cp_free_lang_data (tree t)
63546355
DECL_EXTERNAL (t) = 1;
63556356
TREE_STATIC (t) = 0;
63566357
}
6358+
6359+
if (TREE_CODE (t) == FUNCTION_DECL)
6360+
remove_contract_attributes (t);
6361+
63576362
if (TREE_CODE (t) == NAMESPACE_DECL)
63586363
/* We do not need the leftover chaining of namespaces from the
63596364
binding level. */

0 commit comments

Comments
 (0)