]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/121703 - UBSAN error with moving from uninit data
authorRichard Biener <rguenther@suse.de>
Fri, 5 Sep 2025 12:47:33 +0000 (14:47 +0200)
committerRichard Biener <rguenther@suse.de>
Thu, 11 Sep 2025 09:26:24 +0000 (11:26 +0200)
The PR reports

vectorizer.h:276:3: runtime error: load of value 32695, which is not a valid value for type 'internal_fn'

which I believe is from

      slp_node->data = new vect_load_store_data (std::move (ls));

where 'ls' can be partly uninitialized (and that data will be not
used, but of course the move CTOR doesn't know this).  The following
tries to fix that by using value-initialization of 'ls'.

PR tree-optimization/121703
* tree-vect-stmts.cc (vectorizable_store): Value-initialize ls.
(vectorizable_load): Likewise.

gcc/tree-vect-stmts.cc

index 9fcc2fd084987e564f496a02af7d2b8547c11cd5..7eabf169a2be869168916f6a5b402f24381c1d4f 100644 (file)
@@ -7881,7 +7881,7 @@ vectorizable_store (vec_info *vinfo,
   if (!STMT_VINFO_DATA_REF (stmt_info))
     return false;
 
-  vect_load_store_data _ls_data;
+  vect_load_store_data _ls_data{};
   vect_load_store_data &ls = slp_node->get_data (_ls_data);
   if (cost_vec
       && !get_load_store_type (vinfo, stmt_info, vectype, slp_node, mask_node,
@@ -9451,7 +9451,7 @@ vectorizable_load (vec_info *vinfo,
   else
     group_size = 1;
 
-  vect_load_store_data _ls_data;
+  vect_load_store_data _ls_data{};
   vect_load_store_data &ls = slp_node->get_data (_ls_data);
   if (cost_vec
       && !get_load_store_type (vinfo, stmt_info, vectype, slp_node, mask_node,