tree-optimization/120924 - up --param uninit-max-chain-len

The PR shows that the uninit analysis limits are set too low in
cases we lower switches to ifs as happens on s390x for a linux
kernel TU.  This causes false positive uninit diagnostics as we
abort the attempt to prove that a value is initialized on all
paths.  The new testcase only would require upping to 9.

	PR tree-optimization/120924
	* params.opt (uninit-max-chain-len): Up from 8 to 12.

	* gcc.dg/uninit-pr120924.c: New testcase.

(cherry picked from commit cf9a479e3f)
This commit is contained in:
Richard Biener 2025-07-18 09:02:09 +02:00
parent a8512a6587
commit e1828db8e7
2 changed files with 35 additions and 1 deletions

View File

@ -1181,7 +1181,7 @@ Common Joined UInteger Var(param_uninit_control_dep_attempts) Init(1000) Integer
Maximum number of nested calls to search for control dependencies during uninitialized variable analysis.
-param=uninit-max-chain-len=
Common Joined UInteger Var(param_uninit_max_chain_len) Init(8) IntegerRange(1, 128) Param Optimization
Common Joined UInteger Var(param_uninit_max_chain_len) Init(12) IntegerRange(1, 128) Param Optimization
Maximum number of predicates anded for each predicate ored in the normalized
predicate chain.

View File

@ -0,0 +1,34 @@
/* { dg-do compile } */
/* { dg-options "-O2 -Wmaybe-uninitialized" } */
int foo(int);
enum {
BPF_TRACE_RAW_TP,
BPF_MODIFY_RETURN,
BPF_LSM_MAC,
BPF_TRACE_ITER,
BPF_LSM_CGROUP
};
int btf_get_kernel_prefix_kind_prefix, obj_1, attach_name___trans_tmp_1;
char attach_name_fn_name;
void attach_name(int attach_type)
{
int mod_len;
char mod_name = attach_name_fn_name;
if (attach_name_fn_name)
mod_len = mod_name;
for (; obj_1;) {
if (mod_name && foo(mod_len))
continue;
switch (attach_type) {
case BPF_TRACE_RAW_TP:
case BPF_LSM_MAC:
case BPF_LSM_CGROUP:
btf_get_kernel_prefix_kind_prefix = 1;
case BPF_TRACE_ITER:
attach_name_fn_name = 2;
}
if (attach_name___trans_tmp_1)
return;
}
}