From: Richard Biener Date: Fri, 23 Jun 2023 10:50:50 +0000 (+0200) Subject: Fix initializer_constant_valid_p_1 TYPE_PRECISION use X-Git-Tag: basepoints/gcc-15~8093 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2acbbf41d4c2a3362991863ce265041f9a2feee4;p=thirdparty%2Fgcc.git Fix initializer_constant_valid_p_1 TYPE_PRECISION use initializer_constant_valid_p_1 is letting through all conversions of float vector types that have the same number of elements but that's of course not valid. The following restricts the code to scalar floating point types as was probably intended (only scalar integer types are handled as well). * varasm.cc (initializer_constant_valid_p_1): Only allow conversions between scalar floating point types. --- diff --git a/gcc/varasm.cc b/gcc/varasm.cc index dd84754a283a..f2a19aa6dbd8 100644 --- a/gcc/varasm.cc +++ b/gcc/varasm.cc @@ -4885,7 +4885,8 @@ initializer_constant_valid_p_1 (tree value, tree endtype, tree *cache) /* Allow length-preserving conversions between integer types and floating-point types. */ if (((INTEGRAL_TYPE_P (dest_type) && INTEGRAL_TYPE_P (src_type)) - || (FLOAT_TYPE_P (dest_type) && FLOAT_TYPE_P (src_type))) + || (SCALAR_FLOAT_TYPE_P (dest_type) + && SCALAR_FLOAT_TYPE_P (src_type))) && (TYPE_PRECISION (dest_type) == TYPE_PRECISION (src_type))) return initializer_constant_valid_p_1 (src, endtype, cache);