public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/54783] New: [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code
@ 2012-10-02 19:56 zsojka at seznam dot cz
  2012-10-03  6:34 ` [Bug rtl-optimization/54783] " mpolacek at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zsojka at seznam dot cz @ 2012-10-02 19:56 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54783

             Bug #: 54783
           Summary: [4.8 Regression] valgrind reports using uninitialised
                    data in mark_pseudo_regno_live and make_object_born on
                    basic code
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz


Created attachment 28331
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28331
reduced testcase

Compiler output:
$ gcc testcase.c -wrapper valgrind,-q,--track-origins=yes,--num-callers=40
==11379== Conditional jump or move depends on uninitialised value(s)
==11379==    at 0x8A14AD: mark_pseudo_regno_live(int) (sparseset.h:147)
==11379==    by 0x8A27AC: process_bb_node_lives(ira_loop_tree_node*)
(ira-lives.c:1326)
==11379==    by 0x888C1A: ira_traverse_loop_tree(bool, ira_loop_tree_node*,
void (*)(ira_loop_tree_node*), void (*)(ira_loop_tree_node*))
(ira-build.c:1495)
==11379==    by 0x8A3AB1: ira_create_allocno_live_ranges() (ira-lives.c:1591)
==11379==    by 0x88B52C: ira_build() (ira-build.c:3093)
==11379==    by 0x883936: rest_of_handle_ira() (ira.c:4223)
==11379==    by 0x8FF80C: execute_one_pass(opt_pass*) (passes.c:2191)
==11379==    by 0x8FFBC4: execute_pass_list(opt_pass*) (passes.c:2246)
==11379==    by 0x8FFBD6: execute_pass_list(opt_pass*) (passes.c:2247)
==11379==    by 0x6C26A7: expand_function(cgraph_node*) (cgraphunit.c:1601)
==11379==    by 0x6C4811: compile() (cgraphunit.c:1794)
==11379==    by 0x6C4B34: finalize_compilation_unit() (cgraphunit.c:2080)
==11379==    by 0x5A171F: c_write_global_declarations() (c-decl.c:10116)
==11379==    by 0x9E6234: compile_file() (toplev.c:560)
==11379==    by 0x9E7E09: toplev_main(int, char**) (toplev.c:1863)
==11379==    by 0x5A334BC: (below main) (in /lib64/libc-2.15.so)
==11379==  Uninitialised value was created by a heap allocation
==11379==    at 0x4C29A80: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==11379==    by 0x1168107: xmalloc (xmalloc.c:147)
==11379==    by 0x9CC85F: sparseset_alloc(unsigned long) (sparseset.c:33)
==11379==    by 0x8A3A3F: ira_create_allocno_live_ranges() (ira-lives.c:1583)
==11379==    by 0x88B52C: ira_build() (ira-build.c:3093)
==11379==    by 0x883936: rest_of_handle_ira() (ira.c:4223)
==11379==    by 0x8FF80C: execute_one_pass(opt_pass*) (passes.c:2191)
==11379==    by 0x8FFBC4: execute_pass_list(opt_pass*) (passes.c:2246)
==11379==    by 0x8FFBD6: execute_pass_list(opt_pass*) (passes.c:2247)
==11379==    by 0x6C26A7: expand_function(cgraph_node*) (cgraphunit.c:1601)
==11379==    by 0x6C4811: compile() (cgraphunit.c:1794)
==11379==    by 0x6C4B34: finalize_compilation_unit() (cgraphunit.c:2080)
==11379==    by 0x5A171F: c_write_global_declarations() (c-decl.c:10116)
==11379==    by 0x9E6234: compile_file() (toplev.c:560)
==11379==    by 0x9E7E09: toplev_main(int, char**) (toplev.c:1863)
==11379==    by 0x5A334BC: (below main) (in /lib64/libc-2.15.so)
==11379== 
==11379== Conditional jump or move depends on uninitialised value(s)
==11379==    at 0x8A138A: make_object_born(ira_object*) (sparseset.h:147)
==11379==    by 0x8A14CA: mark_pseudo_regno_live(int) (ira-lives.c:295)
==11379==    by 0x8A27AC: process_bb_node_lives(ira_loop_tree_node*)
(ira-lives.c:1326)
==11379==    by 0x888C1A: ira_traverse_loop_tree(bool, ira_loop_tree_node*,
void (*)(ira_loop_tree_node*), void (*)(ira_loop_tree_node*))
(ira-build.c:1495)
==11379==    by 0x8A3AB1: ira_create_allocno_live_ranges() (ira-lives.c:1591)
==11379==    by 0x88B52C: ira_build() (ira-build.c:3093)
==11379==    by 0x883936: rest_of_handle_ira() (ira.c:4223)
==11379==    by 0x8FF80C: execute_one_pass(opt_pass*) (passes.c:2191)
==11379==    by 0x8FFBC4: execute_pass_list(opt_pass*) (passes.c:2246)
==11379==    by 0x8FFBD6: execute_pass_list(opt_pass*) (passes.c:2247)
==11379==    by 0x6C26A7: expand_function(cgraph_node*) (cgraphunit.c:1601)
==11379==    by 0x6C4811: compile() (cgraphunit.c:1794)
==11379==    by 0x6C4B34: finalize_compilation_unit() (cgraphunit.c:2080)
==11379==    by 0x5A171F: c_write_global_declarations() (c-decl.c:10116)
==11379==    by 0x9E6234: compile_file() (toplev.c:560)
==11379==    by 0x9E7E09: toplev_main(int, char**) (toplev.c:1863)
==11379==    by 0x5A334BC: (below main) (in /lib64/libc-2.15.so)
==11379==  Uninitialised value was created by a heap allocation
==11379==    at 0x4C29A80: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==11379==    by 0x1168107: xmalloc (xmalloc.c:147)
==11379==    by 0x9CC85F: sparseset_alloc(unsigned long) (sparseset.c:33)
==11379==    by 0x8A3A3F: ira_create_allocno_live_ranges() (ira-lives.c:1583)
==11379==    by 0x88B52C: ira_build() (ira-build.c:3093)
==11379==    by 0x883936: rest_of_handle_ira() (ira.c:4223)
==11379==    by 0x8FF80C: execute_one_pass(opt_pass*) (passes.c:2191)
==11379==    by 0x8FFBC4: execute_pass_list(opt_pass*) (passes.c:2246)
==11379==    by 0x8FFBD6: execute_pass_list(opt_pass*) (passes.c:2247)
==11379==    by 0x6C26A7: expand_function(cgraph_node*) (cgraphunit.c:1601)
==11379==    by 0x6C4811: compile() (cgraphunit.c:1794)
==11379==    by 0x6C4B34: finalize_compilation_unit() (cgraphunit.c:2080)
==11379==    by 0x5A171F: c_write_global_declarations() (c-decl.c:10116)
==11379==    by 0x9E6234: compile_file() (toplev.c:560)
==11379==    by 0x9E7E09: toplev_main(int, char**) (toplev.c:1863)
==11379==    by 0x5A334BC: (below main) (in /lib64/libc-2.15.so)
==11379== 

Tested revisions:
r191953 - fail
r191586 - fail
4.7 r191640 - OK


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/54783] [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code
  2012-10-02 19:56 [Bug rtl-optimization/54783] New: [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code zsojka at seznam dot cz
@ 2012-10-03  6:34 ` mpolacek at gcc dot gnu.org
  2012-10-03  6:54 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2012-10-03  6:34 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54783

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> 2012-10-03 06:34:18 UTC ---
Not a bug, probably.  Valgrind ought to be used only when
--enable-checking=valgrind.  Otherwise we have to live with those sparseset
warnings, as those valgrind markups aren't compiled in.

The thing is in gcc-4.7 sparseset_alloc we have:
  /* We use xcalloc rather than xmalloc to silence some valgrind uninitialized
     read errors when accessing set->sparse[n] when "n" is not, and never has
     been, in the set.  These uninitialized reads are expected, by design and
     harmless.  If this turns into a performance problem due to some future
     additional users of sparseset, we can revisit this decision.  */
  sparseset set = (sparseset) xcalloc (1, n_bytes);

But in trunk sparseset_alloc there's:
  sparseset set = XNEWVAR(struct sparseset_def, n_bytes);

  /* Mark the sparseset as defined to silence some valgrind uninitialized
     read errors when accessing set->sparse[n] when "n" is not, and never has
     been, in the set.  These uninitialized reads are expected, by design and
     harmless.  */
  VALGRIND_DISCARD (VALGRIND_MAKE_MEM_DEFINED (set, n_bytes));


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/54783] [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code
  2012-10-02 19:56 [Bug rtl-optimization/54783] New: [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code zsojka at seznam dot cz
  2012-10-03  6:34 ` [Bug rtl-optimization/54783] " mpolacek at gcc dot gnu.org
@ 2012-10-03  6:54 ` jakub at gcc dot gnu.org
  2012-10-04 12:18 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-10-03  6:54 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54783

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-10-03 06:54:22 UTC ---
Alternative would be to check for valgrind devel headers always, tweak the
existing VALGRIND* macros used in gcc sources such that it would be only used
if ENABLE_VALGRIND_CHECKING (otherwise expand to nothing) and in sparseset for
hosts that have valgrind support, but no valgrind devel headers, fall back to
XCNEWVEC, otherwise if valgrind devel headers are available, use the valgrind
special insn even without --enable-checking=valgrind.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/54783] [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code
  2012-10-02 19:56 [Bug rtl-optimization/54783] New: [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code zsojka at seznam dot cz
  2012-10-03  6:34 ` [Bug rtl-optimization/54783] " mpolacek at gcc dot gnu.org
  2012-10-03  6:54 ` jakub at gcc dot gnu.org
@ 2012-10-04 12:18 ` rguenth at gcc dot gnu.org
  2012-11-13  7:29 ` jakub at gcc dot gnu.org
  2012-12-07 11:46 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-10-04 12:18 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54783

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.8.0

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-10-04 12:18:27 UTC ---
Would be definitely nice to split up the valgrind-checking code, with the
annotations enabled by default for yes checking (if the headers are there).


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/54783] [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code
  2012-10-02 19:56 [Bug rtl-optimization/54783] New: [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2012-10-04 12:18 ` rguenth at gcc dot gnu.org
@ 2012-11-13  7:29 ` jakub at gcc dot gnu.org
  2012-12-07 11:46 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-13  7:29 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54783

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-13 07:29:25 UTC ---
*** Bug 55290 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug rtl-optimization/54783] [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code
  2012-10-02 19:56 [Bug rtl-optimization/54783] New: [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2012-11-13  7:29 ` jakub at gcc dot gnu.org
@ 2012-12-07 11:46 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-12-07 11:46 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54783

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> 2012-12-07 11:46:00 UTC ---
Not a bug.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-07 11:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-02 19:56 [Bug rtl-optimization/54783] New: [4.8 Regression] valgrind reports using uninitialised data in mark_pseudo_regno_live and make_object_born on basic code zsojka at seznam dot cz
2012-10-03  6:34 ` [Bug rtl-optimization/54783] " mpolacek at gcc dot gnu.org
2012-10-03  6:54 ` jakub at gcc dot gnu.org
2012-10-04 12:18 ` rguenth at gcc dot gnu.org
2012-11-13  7:29 ` jakub at gcc dot gnu.org
2012-12-07 11:46 ` rguenth at gcc dot gnu.org

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).