public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "david at ixit dot cz" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/109714] New: bogus may be used uninitialized warning Date: Wed, 03 May 2023 14:13:49 +0000 [thread overview] Message-ID: <bug-109714-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109714 Bug ID: 109714 Summary: bogus may be used uninitialized warning Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: david at ixit dot cz Target Milestone: --- Host: x86_64 Target: x86_64 Code: https://gitlab.freedesktop.org/mesa/mesa/ main branch Compiler: 13.0.1 20230315 (experimental) [master r13-6680-ga9ae16db8cb] Compilation: ``` CC=/usr/lib/gcc-snapshot/bin/gcc CXX=/usr/lib/gcc-snapshot/bin/g++ meson setup builddir-snapshot -D libdir=lib -D buildtype=release -D build-tests=false -D enable-glcpp-tests=false -D libunwind=enabled -D glx=dri -D gbm=enabled -D egl=enabled -D platforms=x11,wayland -D dri3=enabled -D gallium-extra-hud=true -D gallium-vdpau=disabled -D gallium-omx=disabled -D gallium-va=disabled -D gallium-xa=disabled -D gallium-nine=false -D gallium-opencl=disabled -D gallium-rusticl=false -D llvm=enabled -D gallium-drivers=i915,iris,swrast -D vulkan-drivers= -D video-codecs=h264dec,h264enc,h265dec,h265enc -D spirv-to-dxil=false -D osmesa=true -D intel-clc=disabled -D imagination-srv=false ``` ``` [1110/1401] Compiling C object src/gallium/auxiliary/libgallium.a.p/draw_draw_llvm.c.o In function 'generate_clipmask', inlined from 'draw_llvm_generate' at ../src/gallium/auxiliary/draw/draw_llvm.c:2163:24: ../src/gallium/auxiliary/draw/draw_llvm.c:1496:25: warning: 'sum' may be used uninitialized [-Wmaybe-uninitialized] 1496 | sum = lp_build_fmuladd(builder, planes, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1497 | (LLVMValueRef[]){cv_x, cv_y, cv_z, cv_w}[i], sum); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/gallium/auxiliary/draw/draw_llvm.c: In function 'draw_llvm_generate': ../src/gallium/auxiliary/draw/draw_llvm.c:1343:44: note: 'sum' was declared here 1343 | LLVMValueRef plane1, planes, plane_ptr, sum; | ``` The code (relevant to the sum variable): ``` ... LLVMValueRef plane1, planes, plane_ptr, sum; ... for (int i = 0; i < 4; ++i) { indices[2] = lp_build_const_int32(gallivm, i); plane_ptr = LLVMBuildGEP2(builder, planes_type, planes_ptr, indices, 3, ""); plane1 = LLVMBuildLoad2(builder, vs_elem_type, plane_ptr, (const char *[]){"plane_x", "plane_y", "plane_z", "plane_w"}[i]); planes = lp_build_broadcast(gallivm, vs_type_llvm, plane1); if (i == 0) { sum = LLVMBuildFMul(builder, planes, cv_x, ""); // sum is set always in first iteration } else { // we never get here without having sum already assigned sum = lp_build_fmuladd(builder, planes, (LLVMValueRef[]){cv_x, cv_y, cv_z, cv_w}[i], sum); } } ... ``` Thou the `sum` value is always assigned in first for interation. I tried do simple test case, but it always works with simple c file.
next reply other threads:[~2023-05-03 14:13 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-03 14:13 david at ixit dot cz [this message] 2023-05-03 18:08 ` [Bug tree-optimization/109714] bogus "may be used uninitialized warning" pinskia at gcc dot gnu.org 2023-05-04 6:07 ` rguenth at gcc dot gnu.org 2023-05-04 18:40 ` david at ixit dot cz 2023-05-04 18:41 ` pinskia at gcc dot gnu.org 2023-05-04 18:47 ` [Bug tree-optimization/109714] mesa/aux/draw_llvm: " pinskia at gcc dot gnu.org 2023-05-05 8:51 ` david at ixit dot cz 2023-05-05 16:20 ` pinskia at gcc dot gnu.org 2023-05-05 16:25 ` pinskia at gcc dot gnu.org 2023-05-05 19:11 ` david at ixit dot cz 2023-05-05 20:19 ` david at ixit dot cz
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=bug-109714-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.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: linkBe 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).