PR target/115840.
In riscv_preferred_else_value, we create an uninitialized tmp var
for else value, instead of the 0 (as default_preferred_else_value)
or the pre-exists VAR (as aarch64 does), so that we can use agnostic
policy.
The problem is that `warn_uninit` will emit a warning:
'({anonymous})' may be used uninitialized
Let's mark this tmp var as NO_WARNING.
This problem is found when I try to build glibc with V extension.
gcc
PR target/115840
* config/riscv/riscv.cc(riscv_preferred_else_value): Mark
tmp_var as NO_WARNING.
gcc/testsuite
* gcc.dg/vect/pr115840.c: New testcase.
tree *ops)
{
if (riscv_v_ext_mode_p (TYPE_MODE (vectype)))
- return get_or_create_ssa_default_def (cfun, create_tmp_var (vectype));
+ {
+ tree tmp_var = create_tmp_var (vectype);
+ TREE_NO_WARNING (tmp_var) = 1;
+ return get_or_create_ssa_default_def (cfun, tmp_var);
+ }
return default_preferred_else_value (ifn, vectype, nops, ops);
}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-Wall -Werror" } */
+
+double loads[16];
+
+void
+foo (double loadavg[], int count)
+{
+ for (int i = 0; i < count; i++)
+ loadavg[i] = loads[i] / 1.5;
+}