public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: 钟居哲 <juzhe.zhong@rivai.ai>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>,
	 "kito.cheng" <kito.cheng@gmail.com>, andrew <andrew@sifive.com>,
	rguenther <rguenther@suse.de>
Subject: Re: Re: [PATCH] RISC-V: Add runtime invariant support
Date: Sat, 20 Aug 2022 20:52:30 -0700	[thread overview]
Message-ID: <CA+=Sn1k0k=rjGi6vZKLpv=waN5i6EVo==m2hzQz0eQLm9qjZ2Q@mail.gmail.com> (raw)
In-Reply-To: <504CA3A3842082E0+202208210828277008452@rivai.ai>

On Sat, Aug 20, 2022 at 5:29 PM 钟居哲 <juzhe.zhong@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.zhong@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.zhong@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.zhong@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 <schwab@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, schwab@linux-m68k.org
> > > GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> > > "And now for something completely different."
> >
>

  reply	other threads:[~2022-08-21  3:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17  7:19 juzhe.zhong
2022-08-20 22:33 ` Andreas Schwab
2022-08-20 23:53   ` Andrew Pinski
2022-08-21  0:05     ` 钟居哲
2022-08-21  0:18       ` Andrew Pinski
2022-08-21  0:28         ` 钟居哲
2022-08-21  3:52           ` Andrew Pinski [this message]
2022-08-22  6:14     ` Richard Biener
2022-08-23  9:34       ` Richard Biener
2022-08-24  1:02         ` juzhe.zhong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+=Sn1k0k=rjGi6vZKLpv=waN5i6EVo==m2hzQz0eQLm9qjZ2Q@mail.gmail.com' \
    --to=pinskia@gmail.com \
    --cc=andrew@sifive.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.com \
    --cc=rguenther@suse.de \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).