On Sat, Aug 20, 2022 at 5:29 PM 钟居哲 <juzhe.zh...@rivai.ai> wrote:
>
> OK. Thank you. I am gonna try it again and fix this in RISC-V port.

The fix is not in the RISC-V port, the fix needs to happen in
vect_gen_vector_loop_niters (tree-vect-loop-manip.cc).
I described why the code is broken, the second use of const_vf is not
connected at all to vf.is_constant (&const_vf) so it will be
uninitilized there.

Thanks,
Andrew

>
> ________________________________
> juzhe.zh...@rivai.ai
>
>
> From: Andrew Pinski
> Date: 2022-08-21 08:18
> To: 钟居哲
> CC: Andreas Schwab; gcc-patches; kito.cheng; andrew; rguenther
> Subject: Re: Re: [PATCH] RISC-V: Add runtime invariant support
> On Sat, Aug 20, 2022 at 5:06 PM 钟居哲 <juzhe.zh...@rivai.ai> wrote:
> >
> > Hi, it seems that this warning still report if I revert my patch. Am I 
> > right? Feel free to correct me. Maybe I need to try it again?
>
> The warning will not be still there. The reason is NUM_POLY_INT_COEFFS
> defaults to 1 which means vf.is_constant (&const_vf) will always
> return true and will always set const_vf.
> I don't know why the warning does not happen on aarch64-linux-gnu (the
> other target where NUM_POLY_INT_COEFFS is set to 2) though; it just
> might be slightly different IR which causes the warning mechanism not
> to warn.
>
> Thanks,
> Andrew Pinski
>
>
> >
> > ________________________________
> > juzhe.zh...@rivai.ai
> >
> >
> > From: Andrew Pinski
> > Date: 2022-08-21 07:53
> > To: Andreas Schwab
> > CC: juzhe.zhong; gcc-patches; kito.cheng; andrew; Richard Guenther
> > Subject: Re: [PATCH] RISC-V: Add runtime invariant support
> > On Sat, Aug 20, 2022 at 3:34 PM Andreas Schwab <sch...@linux-m68k.org> 
> > wrote:
> > >
> > > This breaks bootstrap:
> > >
> > > ../../gcc/tree-vect-loop-manip.cc: In function 'void 
> > > vect_gen_vector_loop_niters(loop_vec_info, tree, tree_node**, 
> > > tree_node**, bool)':
> > > ../../gcc/tree-vect-loop-manip.cc:1981:26: error: 'const_vf' may be used 
> > > uninitialized [-Werror=maybe-uninitialized]
> > >  1981 |   unsigned HOST_WIDE_INT const_vf;
> > >       |                          ^~~~~~~~
> > > cc1plus: all warnings being treated as errors
> > > make[3]: *** [Makefile:1146: tree-vect-loop-manip.o] Error 1
> > > make[2]: *** [Makefile:4977: all-stage2-gcc] Error 2
> > > make[1]: *** [Makefile:30363: stage2-bubble] Error 2
> > > make: *** [Makefile:1065: all] Error 2
> >
> >
> > This looks like a real uninitialized variable issue.
> > I even can't tell if the paths that lead to using const_vf will be
> > always set so how we expect GCC to do the same.
> > The code that uses const_vf was added with r11-5820-cdcbef3c3310,
> > CCing the author there.
> >
> > Thanks,
> > Andrew
> >
> > >
> > > --
> > > Andreas Schwab, sch...@linux-m68k.org
> > > GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> > > "And now for something completely different."
> >
>

Reply via email to