Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/compound-assignment-pr112969.c

raw
1 /* Reduced from -Wanalyzer-exposure-through-uninit-copy false positives
2 seen in Linux kernel in drivers/net/ethernet/intel/ice/ice_ptp.c */
3
4 #include "analyzer-decls.h"
5
6 /* { dg-do compile } */
7
8 struct hwtstamp_config
9 {
10 int flags;
11 int tx_type;
12 int rx_filter;
13 };
14
15 struct ice_ptp
16 {
17 long placeholder;
18 struct hwtstamp_config tstamp_config;
19 };
20
21 struct ice_pf
22 {
23 struct ice_ptp ptp;
24 };
25
26 void
27 ice_ptp_set_ts_config(struct ice_pf* pf)
28 {
29 struct hwtstamp_config config;
30 pf->ptp.tstamp_config.tx_type = 1;
31 pf->ptp.tstamp_config.rx_filter = 2;
32 config = pf->ptp.tstamp_config;
33 __analyzer_eval (config.flags == pf->ptp.tstamp_config.flags); /* { dg-warning "TRUE" } */
34 /* { dg-bogus "use of uninitialized value 'config.flags'" "PR analyzer/112969" { target *-*-* } .-1 } */
35 }