aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/compound-assignment-pr112969.c
blob: 4bc037cb7cfc44b4fc94ba6bee893bddc1e2de8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Reduced from -Wanalyzer-exposure-through-uninit-copy false positives
   seen in Linux kernel in drivers/net/ethernet/intel/ice/ice_ptp.c  */

#include "analyzer-decls.h"

/* { dg-do compile } */

struct hwtstamp_config
{
  int flags;
  int tx_type;
  int rx_filter;
};

struct ice_ptp
{
  long placeholder;
  struct hwtstamp_config tstamp_config;
};

struct ice_pf
{
  struct ice_ptp ptp;
};

void
ice_ptp_set_ts_config(struct ice_pf* pf)
{
  struct hwtstamp_config config;
  pf->ptp.tstamp_config.tx_type = 1;
  pf->ptp.tstamp_config.rx_filter = 2;
  config = pf->ptp.tstamp_config;
  __analyzer_eval (config.flags == pf->ptp.tstamp_config.flags); /* { dg-warning "TRUE" } */
  /* { dg-bogus "use of uninitialized value 'config.flags'" "PR analyzer/112969" { target *-*-* } .-1 } */
}