On Fri, 17 Dec 2021 19:01:31 +0000
Dmitry Kozlyuk <dkozl...@nvidia.com> wrote:

> > Building current main branch with gcc (Debian 10.2.1-6) 10.2.1 20210110
> > 
> > 
> > [1843/3131] Compiling C object
> > drivers/libtmp_rte_net_mlx5.a.p/net_mlx5_mlx5_flow_meter.c.o
> > ../drivers/net/mlx5/mlx5_flow_meter.c: In function
> > ‘mlx5_flow_meter_create’:
> > ../drivers/net/mlx5/mlx5_flow_meter.c:1170:33: warning: ‘legacy_fm’ may be
> > used uninitialized in this function [-Wmaybe-uninitialized]
> >  1170 |  struct mlx5_legacy_flow_meter *legacy_fm;
> >       |                                 ^~~~~~~~~  
> 
> Hi Stephen,
> 
> I don't see this warning with gcc 10.3.0 (Ubuntu 10.3.0-1ubuntu1~20.04).
> Firstly, I believe it's a false positive:
> legacy_fm is initialized and used only when priv->sh->meter_aso_en == false:
> 
> 1237  if (priv->sh->meter_aso_en) {
>               ...
> 1245  } else {
>               legacy_fm = ...
>               if (legacy_fm == NULL)
>                       return ...;
>               ...
>       }
>       ...
> 1276  if (!priv->sh->meter_aso_en)
>               TAILQ_INSERT_TAIL(fms, legacy_fm, next);
> 
> However, even if it's fixed in GCC between 10.2.1 and 10.3.0,
> I've seen it with x86_64-w64-mingw32-gcc (GCC) 9.3-win32 20200320
> while working on enabling drivers/*/mlx5 build with GCC,
> so a workaround will probably still be needed.

It maybe because I was testing with thread santizer enabled and compiler
was doing different optimizations.

Reply via email to