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

            Bug ID: 61328
           Summary: valgrind finds problem in find_bswap_or_nop_1
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com

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

I just compiled the attached code with gcc trunk 20140526 with flag -O2 under
valgrind and it said

==24014== Conditional jump or move depends on uninitialised value(s)
==24014==    at 0xA8F1F5: find_bswap_or_nop_1(gimple_statement_base*,
symbolic_number*, int) (tree-ssa-math-opts.c:1918)
==24014==    by 0xA8FD14: (anonymous
namespace)::pass_optimize_bswap::execute(function*) (tree-ssa-math-opts.c:2034)
==24014==    by 0x8AA350: execute_one_pass(opt_pass*) (passes.c:2180)
==24014==    by 0x8AAAF7: execute_pass_list_1(opt_pass*) (passes.c:2233)
==24014==    by 0x8AADC7: execute_pass_list(function*, opt_pass*)
(passes.c:2234)
==24014==    by 0x64757C: expand_function(cgraph_node*) (cgraphunit.c:1783)
==24014==    by 0x64926C: compile() [clone .part.31] (cgraphunit.c:1917)

tree-ssa-math-opts.c:1918 is

      if (n1.size != n2.size || !source_expr2)
        return NULL_TREE;

Maybe

      if (!source_expr2)
        return NULL_TREE;

      if (n1.size != n2.size)
        return NULL_TREE;

would be better code.

Reply via email to