From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id 936D63858D37 for ; Tue, 23 Aug 2022 09:34:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 936D63858D37 Received: by mail-ed1-x530.google.com with SMTP id z2so17279141edc.1 for ; Tue, 23 Aug 2022 02:34:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=a23e6WKk6Bn/E8Rm26wj9THgTsXTyS93wrCxs22McMw=; b=FYq6DTFIXsY+cylkcMHUvQpiHjX2bAVpbLoTcQTCuF6SiPmzvyQEb2wQkfz2dncZ7+ MkqhUxavjvAVOjnYkHKq6ivB+7s+EFmFfP0l0z/4nzxvLYiDU0TdVHwO2RajCs4n8CeA iXJIGCtBetGRs4hQjgkLEZ3LXaKZvFHQWeNXFfOzhtjsXNTLmkcIcrjjEMwTMC7ToyHg ceCR2UlJb46Aj+36kc4+CYu9cML30jbPm4DfDktgjRVPOpbFjX5XfSWd9EV0y18PP+ml /MjAE0fwZqX9c9g9Uh/kgsGeCJrldvz6A/jtv9L0r+jUAVZp/2ZLhZYx2Vd0sM1aqoJI rUvQ== X-Gm-Message-State: ACgBeo1zEJCc0U9ydaqRsz6zuwqT3TXi3wkaZpyblxpRTSn9n28m1QzS CaiKsNvHM0dfk9iwxL41+7EvDsy6sl9kl3KdHPc= X-Google-Smtp-Source: AA6agR6xcfJpy/Gg56WnYp9ujrmB19xdUstwfLUAGYxFMY2eY71ZSUpj22QFBp9vrYZz3vBYqWJnQ4EVnWGFAFfLnUE= X-Received: by 2002:a05:6402:2694:b0:447:24fc:1749 with SMTP id w20-20020a056402269400b0044724fc1749mr1321659edd.250.1661247282189; Tue, 23 Aug 2022 02:34:42 -0700 (PDT) MIME-Version: 1.0 References: <20220817071950.271762-1-juzhe.zhong@rivai.ai> <87h726h7et.fsf@linux-m68k.org> In-Reply-To: From: Richard Biener Date: Tue, 23 Aug 2022 11:34:29 +0200 Message-ID: Subject: Re: [PATCH] RISC-V: Add runtime invariant support To: Richard Biener Cc: Andrew Pinski , GCC Patches , Andrew Waterman , Andreas Schwab , Kito Cheng , juzhe.zhong@rivai.ai Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2022 09:34:46 -0000 On Mon, Aug 22, 2022 at 8:15 AM Richard Biener via Gcc-patches wrote: > > On Sat, 20 Aug 2022, Andrew Pinski wrote: > > > On Sat, Aug 20, 2022 at 3:34 PM Andreas Schwab 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.