The following removes the location from CSWTCH variables which are
DECL_IGNORED_P and have no DECL_CONTEXT. The location is currently
taken from the gswitch statement and thus includes a BLOCK reference
which can eventually be elided and GCd, causing later ICEs when
ICF decides to merge the variable with some other.
Bootstrap and regtest running on x86_64-unknown-linux-gnu.
PR tree-optimization/114274
* tree-switch-conversion.cc (switch_conversion::build_one_array):
Use UNKNOWN_LOCATION for the CSWTCH decl.
---
gcc/tree-switch-conversion.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
index cc2b0a5ec30..8ae989b5783 100644
--- a/gcc/tree-switch-conversion.cc
+++ b/gcc/tree-switch-conversion.cc
@@ -1030,7 +1030,7 @@ switch_conversion::build_one_array (int num, tree
arr_index_type,
TREE_CONSTANT (ctor) = true;
TREE_STATIC (ctor) = true;
- decl = build_decl (loc, VAR_DECL, NULL_TREE, array_type);
+ decl = build_decl (UNKNOWN_LOCATION, VAR_DECL, NULL_TREE, array_type);
TREE_STATIC (decl) = 1;
DECL_INITIAL (decl) = ctor;
--
2.51.0