https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86326

            Bug ID: 86326
           Summary: Conditional jump or move depends on uninitialized
                    value in calculate_allocatation_cost (ira.c:2457)
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sduvan.gcc at gmail dot com
  Target Milestone: ---

Created attachment 44323
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44323&action=edit
Preprocessed source

The reduced testcase triggers a valgrind error.

Running valgrind --trace-children=yes --expensive-definedness-checks=yes
/opt/gcc/8.1.0/bin/g++ -m32 -c ./bug.ii

gives (ignoring/suppressing the benign reports related to sparseset_bit_p)

==146658== Conditional jump or move depends on uninitialised value(s)
==146658==    at 0xA28F8D: calculate_allocation_cost (ira.c:2457)
==146658==    by 0xA28F8D: ira (ira.c:5377)
==146658==    by 0xA28F8D: (anonymous namespace)::pass_ira::execute(function*)
(ira.c:5606)
==146658==    by 0xAEB8B1: execute_one_pass(opt_pass*) (passes.c:2497)
==146658==    by 0xAEC027: execute_pass_list_1(opt_pass*) (passes.c:2586)
==146658==    by 0xAEC039: execute_pass_list_1(opt_pass*) (passes.c:2587)
==146658==    by 0xAEC078: execute_pass_list(function*, opt_pass*)
(passes.c:2597)
==146658==    by 0x85437C: cgraph_node::expand() (cgraphunit.c:2139)
==146658==    by 0x855663: output_in_order (cgraphunit.c:2381)
==146658==    by 0x855663: symbol_table::compile() [clone .part.72]
(cgraphunit.c:2623)
==146658==    by 0x857109: compile (cgraphunit.c:2537)
==146658==    by 0x857109: symbol_table::finalize_compilation_unit()
(cgraphunit.c:2717)
==146658==    by 0xBA7987: compile_file() (toplev.c:480)
==146658==    by 0x6346FE: do_compile (toplev.c:2132)
==146658==    by 0x6346FE: toplev::main(int, char**) (toplev.c:2267)
==146658==    by 0x63699A: main (main.c:39)

bash> /opt/gcc/8.1.0/bin/g++ -v
Using built-in specs.
COLLECTGCC=/opt/gcc/8.1.0/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc/8.1.0/lib/gcc/x86_64-suse-linux/8.1.0/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../../gcc-8.1.0/configure --enable-languages=c,c++,fortran
--enable-targets=x86_64-suse-linux,i686-suse-linux --prefix=/opt/gcc/8.1.0
--with-gnu-as --with-as=/opt/gcc/binutils-2.30/bin/as --with-gnu-ld
--with-ld=/opt/gcc/binutils-2.30/bin/ld.bfd --enable-threads=posix
--enable-shared --enable-__cxa_atexit --enable-libstdcxx-allocator=pool
x86_64-suse-linux
Thread model: posix
gcc version 8.1.0 (GCC)

I'm aware of BZ 83321 but was under the impression that such issues with
valgrind would not be possible when using --expensive-definedness-checks=yes.

Reply via email to