public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/42941]  New: -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable
@ 2010-02-02 21:30 zsojka at seznam dot cz
  2010-02-02 21:32 ` [Bug rtl-optimization/42941] " zsojka at seznam dot cz
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2010-02-02 21:30 UTC (permalink / raw)
  To: gcc-bugs

Command line:
gcc -fsched-pressure -fschedule-insns -c testcase.c

Tested revisions:
r156367 - fail

------- testcase.c --------
int foo(void)
{
        return 0;
}
---------------------------

Output:
$ valgrind --track-origins=yes
/mnt/svn/gcc-trunk/binary-156367-lto/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/cc1plus
-fsched-pressure -fschedule-insns testcase.c 
==15355== Memcheck, a memory error detector
==15355== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==15355== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==15355== Command:
/mnt/svn/gcc-trunk/binary-156367-lto/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/cc1plus
-fsched-pressure -fschedule-insns testcase.c
==15355==                                                                       
 int foo()                                                                      
Analyzing compilation unit                                                      
Performing interprocedural optimizations                                        
 <visibility> <*free_lang_data> <early_local_cleanups> <whole-program>
<inline>Assembling functions:                                                   
 int foo()==15355== Conditional jump or move depends on uninitialised value(s)  
==15355==    at 0xD35F88: setup_insn_max_reg_pressure (haifa-sched.c:1597)      
==15355==    by 0x8A9C5F: schedule_insns (sched-rgn.c:2965)                     
==15355==    by 0x8A9DFD: rest_of_handle_sched (sched-rgn.c:3512)               
==15355==    by 0x84FEEA: execute_one_pass (passes.c:1561)                      
==15355==    by 0x850174: execute_pass_list (passes.c:1616)                     
==15355==    by 0x850186: execute_pass_list (passes.c:1617)                     
==15355==    by 0x945C34: tree_rest_of_compilation (tree-optimize.c:413)        
==15355==    by 0xAC70A0: cgraph_expand_function (cgraphunit.c:1543)            
==15355==    by 0xAC7E1F: cgraph_output_in_order (cgraphunit.c:1719)            
==15355==    by 0xAC9E4E: cgraph_optimize (cgraphunit.c:1867)                   
==15355==    by 0xACA024: cgraph_finalize_compilation_unit (cgraphunit.c:1093)  
==15355==    by 0x54E4DA: cp_write_global_declarations (decl2.c:3798)           
==15355==  Uninitialised value was created by a heap allocation                 
==15355==    at 0x4C280AC: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)                          
==15355==    by 0xDE78D7: xmalloc (xmalloc.c:147)                               
==15355==    by 0xD7CD78: sched_analyze_insn (sched-deps.c:2036)                
==15355==    by 0xD7D294: deps_analyze_insn (sched-deps.c:3248)                 
==15355==    by 0xD7DA43: sched_analyze (sched-deps.c:3398)                     
==15355==    by 0x8A819D: sched_rgn_compute_dependencies (sched-rgn.c:2726)     
==15355==    by 0x8A9827: schedule_insns (sched-rgn.c:2938)                     
==15355==    by 0x8A9DFD: rest_of_handle_sched (sched-rgn.c:3512)               
==15355==    by 0x84FEEA: execute_one_pass (passes.c:1561)                      
==15355==    by 0x850174: execute_pass_list (passes.c:1616)                     
==15355==    by 0x850186: execute_pass_list (passes.c:1617)                     
==15355==    by 0x945C34: tree_rest_of_compilation (tree-optimize.c:413)        
==15355==                                                                       
==15355== Conditional jump or move depends on uninitialised value(s)            
==15355==    at 0xD35F88: setup_insn_max_reg_pressure (haifa-sched.c:1597)      
==15355==    by 0xD3BE48: schedule_insn (haifa-sched.c:1632)                    
==15355==    by 0xD3E9D0: schedule_block (haifa-sched.c:3143)                   
==15355==    by 0x8A9B09: schedule_insns (sched-rgn.c:3001)                     
==15355==    by 0x8A9DFD: rest_of_handle_sched (sched-rgn.c:3512)               
==15355==    by 0x84FEEA: execute_one_pass (passes.c:1561)                      
==15355==    by 0x850174: execute_pass_list (passes.c:1616)                     
==15355==    by 0x850186: execute_pass_list (passes.c:1617)                     
==15355==    by 0x945C34: tree_rest_of_compilation (tree-optimize.c:413)        
==15355==    by 0xAC70A0: cgraph_expand_function (cgraphunit.c:1543)            
==15355==    by 0xAC7E1F: cgraph_output_in_order (cgraphunit.c:1719)            
==15355==    by 0xAC9E4E: cgraph_optimize (cgraphunit.c:1867)                   
==15355==  Uninitialised value was created by a heap allocation                 
==15355==    at 0x4C280AC: malloc (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)                          
==15355==    by 0xDE78D7: xmalloc (xmalloc.c:147)                               
==15355==    by 0xD7CD78: sched_analyze_insn (sched-deps.c:2036)                
==15355==    by 0xD7D294: deps_analyze_insn (sched-deps.c:3248)                 
==15355==    by 0xD7DA43: sched_analyze (sched-deps.c:3398)                     
==15355==    by 0x8A819D: sched_rgn_compute_dependencies (sched-rgn.c:2726)     
==15355==    by 0x8A9827: schedule_insns (sched-rgn.c:2938)                     
==15355==    by 0x8A9DFD: rest_of_handle_sched (sched-rgn.c:3512)               
==15355==    by 0x84FEEA: execute_one_pass (passes.c:1561)                      
==15355==    by 0x850174: execute_pass_list (passes.c:1616)                     
==15355==    by 0x850186: execute_pass_list (passes.c:1617)                     
==15355==    by 0x945C34: tree_rest_of_compilation (tree-optimize.c:413)        
==15355==                                                                       
With more complicated code more warnings are issued. I wasn't able to cause
difference in code generated with different --malloc-fill.


-- 
           Summary: -fsched-pressure -fschedule-insns - valgrind warns about
                    using uninitialized variable
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zsojka at seznam dot cz
  GCC host triplet: x86(_64)-pc-linux-gnu
GCC target triplet: x86(_64)-pc-linux-gnu


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


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

* [Bug rtl-optimization/42941] -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable
  2010-02-02 21:30 [Bug rtl-optimization/42941] New: -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable zsojka at seznam dot cz
@ 2010-02-02 21:32 ` zsojka at seznam dot cz
  2010-02-03 10:40 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2010-02-02 21:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from zsojka at seznam dot cz  2010-02-02 21:32 -------
Created an attachment (id=19791)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19791&action=view)
valgrind output for less trivial testcase

Generally, compiling any non-trivial file gives similiar output.
With --malloc-fill=0xff, far less warnings are generated.


-- 


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


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

* [Bug rtl-optimization/42941] -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable
  2010-02-02 21:30 [Bug rtl-optimization/42941] New: -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable zsojka at seznam dot cz
  2010-02-02 21:32 ` [Bug rtl-optimization/42941] " zsojka at seznam dot cz
@ 2010-02-03 10:40 ` rguenth at gcc dot gnu dot org
  2010-02-03 18:57 ` vmakarov at redhat dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-02-03 10:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rguenth at gcc dot gnu dot org  2010-02-03 10:40 -------
Vlad?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vmakarov at gcc dot gnu dot
                   |                            |org
           Keywords|                            |wrong-code


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


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

* [Bug rtl-optimization/42941] -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable
  2010-02-02 21:30 [Bug rtl-optimization/42941] New: -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable zsojka at seznam dot cz
  2010-02-02 21:32 ` [Bug rtl-optimization/42941] " zsojka at seznam dot cz
  2010-02-03 10:40 ` rguenth at gcc dot gnu dot org
@ 2010-02-03 18:57 ` vmakarov at redhat dot com
  2010-02-03 19:02 ` vmakarov at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: vmakarov at redhat dot com @ 2010-02-03 18:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from vmakarov at redhat dot com  2010-02-03 18:57 -------
  This is a rare case when the algorithm works the same whatever values are in
memory.  Roughly speaking, if the value is not as expected (for example a
garbage) the value is set up to what it needed.  If it is one as expected we do
nothing and have the same result.  Valgrind warns because the data is not
initialized.

  I'll submit a patch soon for initialization of the values.  The compiler will
work absolutely the same (may be a bit slower because of the initialization)
but there will be no valgrind warnings which will simplify compiler debugging 
by valgrind.


-- 


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


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

* [Bug rtl-optimization/42941] -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable
  2010-02-02 21:30 [Bug rtl-optimization/42941] New: -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2010-02-03 18:57 ` vmakarov at redhat dot com
@ 2010-02-03 19:02 ` vmakarov at gcc dot gnu dot org
  2010-02-07 20:57 ` pinskia at gcc dot gnu dot org
  2010-03-13  2:52 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: vmakarov at gcc dot gnu dot org @ 2010-02-03 19:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from vmakarov at gcc dot gnu dot org  2010-02-03 19:01 -------
Subject: Bug 42941

Author: vmakarov
Date: Wed Feb  3 19:01:31 2010
New Revision: 156472

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156472
Log:
2010-02-03  Vladimir Makarov  <vmakarov@redhat.com>

        PR rtl-optimizations/42941
        * sched-deps.c (setup_insn_reg_pressure_info): Use xcalloc instead
        of xmalloc.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/sched-deps.c


-- 


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


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

* [Bug rtl-optimization/42941] -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable
  2010-02-02 21:30 [Bug rtl-optimization/42941] New: -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2010-02-03 19:02 ` vmakarov at gcc dot gnu dot org
@ 2010-02-07 20:57 ` pinskia at gcc dot gnu dot org
  2010-03-13  2:52 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-02-07 20:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2010-02-07 20:57 -------
Fixed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


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

* [Bug rtl-optimization/42941] -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable
  2010-02-02 21:30 [Bug rtl-optimization/42941] New: -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2010-02-07 20:57 ` pinskia at gcc dot gnu dot org
@ 2010-03-13  2:52 ` pinskia at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-13  2:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2010-03-13 02:51 -------
*** Bug 43332 has been marked as a duplicate of this bug. ***


-- 


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


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

end of thread, other threads:[~2010-03-13  2:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-02 21:30 [Bug rtl-optimization/42941] New: -fsched-pressure -fschedule-insns - valgrind warns about using uninitialized variable zsojka at seznam dot cz
2010-02-02 21:32 ` [Bug rtl-optimization/42941] " zsojka at seznam dot cz
2010-02-03 10:40 ` rguenth at gcc dot gnu dot org
2010-02-03 18:57 ` vmakarov at redhat dot com
2010-02-03 19:02 ` vmakarov at gcc dot gnu dot org
2010-02-07 20:57 ` pinskia at gcc dot gnu dot org
2010-03-13  2:52 ` pinskia at gcc dot gnu dot 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).