From e48e04f598c89a71a5aff3f02cb38b7bf06b5b2b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 19 Nov 2018 11:36:51 +0000 Subject: [PATCH] re PR c++/87229 (ICE: tree code 'call_expr' is not supported in LTO streams) 2018-11-19 Richard Biener PR lto/87229 * tree.c (free_lang_data_in_one_sizepos): Free non-gimple-val sizepos values. * g++.dg/lto/pr87229_0.C: New testcase. From-SVN: r266271 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/lto/pr87229_0.C | 7 +++++++ gcc/tree.c | 7 +++++++ 4 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/lto/pr87229_0.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 98038718e7d..9cd89fb941b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-19 Richard Biener + + PR lto/87229 + * tree.c (free_lang_data_in_one_sizepos): Free non-gimple-val + sizepos values. + 2018-11-19 Eric Botcazou * compare-elim.c (struct comparison): Add not_in_a field. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3fff2c85e7b..5fce6a84818 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-11-19 Richard Biener + + PR lto/87229 + * g++.dg/lto/pr87229_0.C: New testcase. + 2018-11-19 Martin Liska * g++.dg/gcov/pr84548.C: Remove remove-gcda. diff --git a/gcc/testsuite/g++.dg/lto/pr87229_0.C b/gcc/testsuite/g++.dg/lto/pr87229_0.C new file mode 100644 index 00000000000..1c20e805291 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr87229_0.C @@ -0,0 +1,7 @@ +// { dg-lto-do assemble } + +struct Main { Main(char* x); }; + +Main::Main(char* x) { + char cfg[__builtin_strlen(x)]; +} diff --git a/gcc/tree.c b/gcc/tree.c index be89897d43a..48de9cf350f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5254,6 +5254,13 @@ free_lang_data_in_one_sizepos (tree *expr_p) tree expr = *expr_p; if (CONTAINS_PLACEHOLDER_P (expr)) *expr_p = build0 (PLACEHOLDER_EXPR, TREE_TYPE (expr)); + /* ??? We have to reset all non-GIMPLE sizepos because those eventually + refer to trees we cannot stream. See for example PR87229 which + shows an example with non-gimplified abstract origins in C++. + Note this should only happen for abstract copies so setting sizes + to NULL is OK (but we cannot easily assert this). */ + else if (expr && !is_gimple_val (expr)) + *expr_p = NULL_TREE; } -- 2.30.2