public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Richard Biener <rguenther@suse.de>
Cc: Andrew Pinski <pinskia@gmail.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>,
	 Andrew Waterman <andrew@sifive.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Kito Cheng <kito.cheng@gmail.com>,
	juzhe.zhong@rivai.ai
Subject: Re: [PATCH] RISC-V: Add runtime invariant support
Date: Tue, 23 Aug 2022 11:34:29 +0200	[thread overview]
Message-ID: <CAFiYyc3QQpMxSS9hRPNz-upF8rfnujFcM4q7kN=CUBV1C0+RAA@mail.gmail.com> (raw)
In-Reply-To: <nycvar.YFH.7.77.849.2208220609300.13569@jbgna.fhfr.qr>

On Mon, Aug 22, 2022 at 8:15 AM Richard Biener via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Sat, 20 Aug 2022, Andrew Pinski wrote:
>
> > 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.
>
> The key is
>
>   tree log_vf = NULL_TREE;
> ...
>   unsigned HOST_WIDE_INT const_vf;
>   if (vf.is_constant (&const_vf)
>       && !LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
>     {
> ...
>       log_vf = build_int_cst (type, exact_log2 (const_vf));
> ...
>     }
> ...
>       if (stmts != NULL && log_vf)
>         {
> ... use const_vf ...
>
> so it's uninit analysis little mind that is confused.  There is code
> that's supposed to handle the situation (setting flag under condition,
> testing that flag instead of condition) but maybe it's too twisted
> here.  One could refector this as
>
>  bool const_vf_p = vf.is_constant (&const_vf);
>  if (const_vf_p
>      && ...)
> ...
>    if (stmts != NULL && const_vf_p)
> ...
>
> and hope uninits mind is good enough to see log_vf is not used
> uninitialized.
>
> I can also look into why uninit doesn't get it, but preprocessed
> source would be handy then.

Btw, the riscv speciality is

gcc/config/riscv/riscv.h:#define LOGICAL_OP_NON_SHORT_CIRCUIT 0

with --param logical-op-non-short-circuit=1 the diagnostic does not occur.

>
> Richard.

  reply	other threads:[~2022-08-23  9:34 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
2022-08-22  6:14     ` Richard Biener
2022-08-23  9:34       ` Richard Biener [this message]
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='CAFiYyc3QQpMxSS9hRPNz-upF8rfnujFcM4q7kN=CUBV1C0+RAA@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=andrew@sifive.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=juzhe.zhong@rivai.ai \
    --cc=kito.cheng@gmail.com \
    --cc=pinskia@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).