[gcc r16-7360] tree-optimization/114274 - avoid stray BLOCK refrence from CSWTCH vars
Richard Biener
rguenth@gcc.gnu.org
Fri Feb 6 10:50:48 GMT 2026
https://gcc.gnu.org/g:48e114ee2a0d5b19796f4f03644d9d9925379e1f
commit r16-7360-g48e114ee2a0d5b19796f4f03644d9d9925379e1f
Author: Richard Biener <rguenther@suse.de>
Date: Fri Feb 6 09:26:37 2026 +0100
tree-optimization/114274 - avoid stray BLOCK refrence from CSWTCH vars
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.
PR tree-optimization/114274
* tree-switch-conversion.cc (switch_conversion::build_one_array):
Use UNKNOWN_LOCATION for the CSWTCH decl.
Diff:
---
gcc/tree-switch-conversion.cc | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc
index cc2b0a5ec30c..5027ab559c0b 100644
--- a/gcc/tree-switch-conversion.cc
+++ b/gcc/tree-switch-conversion.cc
@@ -971,7 +971,6 @@ switch_conversion::build_one_array (int num, tree arr_index_type,
tree name;
gimple *load;
gimple_stmt_iterator gsi = gsi_for_stmt (m_switch);
- location_t loc = gimple_location (m_switch);
gcc_assert (m_default_values[num]);
@@ -1030,7 +1029,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;
More information about the Gcc-cvs
mailing list