new file mode 100644
@@ -0,0 +1,7 @@
+// { dg-lto-do assemble }
+
+struct Main { Main(char* x); };
+
+Main::Main(char* x) {
+ char cfg[__builtin_strlen(x)];
+}
@@ -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;
}
The following fixes and ICE in the LTO streamer by releasing non-gimple-val sizepos values in free-lang-data. This works around(?) the C++ FE leaving non-gimplified abstract origins around. LTO bootstrapped & tested on x86_64-unknown-linux-gnu, applied to trunk sofar. Richard. From f7ddb8be8a059b084a1d46bde9a33ba365886b6e Mon Sep 17 00:00:00 2001 From: Richard Guenther <rguenther@suse.de> Date: Mon, 19 Nov 2018 09:28:24 +0100 Subject: [PATCH] fix-pr87229 2018-11-19 Richard Biener <rguenther@suse.de> 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.