public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/44971]  New: -fcompare-debug failure with uninitialized read in walk_gimple_stmt
@ 2010-07-17 11:44 zsojka at seznam dot cz
  2010-07-17 11:46 ` [Bug debug/44971] " zsojka at seznam dot cz
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: zsojka at seznam dot cz @ 2010-07-17 11:44 UTC (permalink / raw)
  To: gcc-bugs

Command line:
$ gcc -O2 -fcompare-debug testcase.c

Valgrind output:
$ valgrind -q --trace-children=yes
/mnt/svn/gcc-trunk/binary-162222-lto-fortran-checking-yes-rtl-df/bin/gcc -O2
-fcompare-debug testcase.c
testcase.c: In function '_XftCloseint':
testcase.c:21:3: warning: passing argument 1 of '_XftintInfoGet' makes pointer
from integer without a cast [enabled by default]
testcase.c:12:6: note: expected 'int *' but argument is of type 'int'
testcase.c:22:13: warning: assignment from incompatible pointer type [enabled
by default]
testcase.c:22:48: warning: assignment from incompatible pointer type [enabled
by default]
==3128== Conditional jump or move depends on uninitialised value(s)
==3128==    at 0x70BFBB: walk_gimple_stmt (gimple.c:1627)
==3128==    by 0x955003: dump_enumerated_decls (tree-ssa-live.c:1264)
==3128==    by 0x8F7B98: execute_cleanup_cfg_post_optimizing
(tree-optimize.c:212)
==3128==    by 0x7B777D: execute_one_pass (passes.c:1563)
==3128==    by 0x7B7A14: execute_pass_list (passes.c:1618)
==3128==    by 0x8F8525: tree_rest_of_compilation (tree-optimize.c:450)
==3128==    by 0xAADBF5: cgraph_expand_function (cgraphunit.c:1629)
==3128==    by 0xAB0A29: cgraph_optimize (cgraphunit.c:1708)
==3128==    by 0xAB101A: cgraph_finalize_compilation_unit (cgraphunit.c:1171)
==3128==    by 0x4DE632: c_write_global_declarations (c-decl.c:9698)
==3128==    by 0x8A41E5: toplev_main (toplev.c:990)
==3128==    by 0x6589BBC: (below main) (in /lib64/libc-2.11.2.so)
==3128== 
gcc: error: testcase.c: -fcompare-debug failure (length)

Tested revisions:
r162222 - fail
r162056 - fail
r161659 - ICEs
r161170 - OK


-- 
           Summary: -fcompare-debug failure with uninitialized read in
                    walk_gimple_stmt
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        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=44971


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

* [Bug debug/44971] -fcompare-debug failure with uninitialized read in walk_gimple_stmt
  2010-07-17 11:44 [Bug debug/44971] New: -fcompare-debug failure with uninitialized read in walk_gimple_stmt zsojka at seznam dot cz
@ 2010-07-17 11:46 ` zsojka at seznam dot cz
  2010-07-17 13:37 ` hjl dot tools at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: zsojka at seznam dot cz @ 2010-07-17 11:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from zsojka at seznam dot cz  2010-07-17 11:46 -------
Created an attachment (id=21234)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21234&action=view)
reduced testcase (from libXft sources)

The original testcase didn't have any implicit conversions from/to/between
pointers.

Command line:
$ gcc -O2 -fcompare-debug pr44971.c


-- 


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


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

* [Bug debug/44971] -fcompare-debug failure with uninitialized read in walk_gimple_stmt
  2010-07-17 11:44 [Bug debug/44971] New: -fcompare-debug failure with uninitialized read in walk_gimple_stmt zsojka at seznam dot cz
  2010-07-17 11:46 ` [Bug debug/44971] " zsojka at seznam dot cz
@ 2010-07-17 13:37 ` hjl dot tools at gmail dot com
  2010-07-17 13:38 ` hjl dot tools at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-07-17 13:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2010-07-17 13:37 -------
It is caused by revision 161655:

http://gcc.gnu.org/ml/gcc-cvs/2010-07/msg00006.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-07-17 13:37:31
               date|                            |


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


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

* [Bug debug/44971] -fcompare-debug failure with uninitialized read in walk_gimple_stmt
  2010-07-17 11:44 [Bug debug/44971] New: -fcompare-debug failure with uninitialized read in walk_gimple_stmt zsojka at seznam dot cz
  2010-07-17 11:46 ` [Bug debug/44971] " zsojka at seznam dot cz
  2010-07-17 13:37 ` hjl dot tools at gmail dot com
@ 2010-07-17 13:38 ` hjl dot tools at gmail dot com
  2010-07-18 17:50 ` [Bug debug/44971] [4.6 Regression] " rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-07-17 13:38 UTC (permalink / raw)
  To: gcc-bugs



-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.0


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


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

* [Bug debug/44971] [4.6 Regression] -fcompare-debug failure with uninitialized read in walk_gimple_stmt
  2010-07-17 11:44 [Bug debug/44971] New: -fcompare-debug failure with uninitialized read in walk_gimple_stmt zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2010-07-17 13:38 ` hjl dot tools at gmail dot com
@ 2010-07-18 17:50 ` rguenth at gcc dot gnu dot org
  2010-07-18 20:47 ` rguenth at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-18 17:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2010-07-18 17:50 -------
Mine.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-07-17 13:37:31         |2010-07-18 17:50:44
               date|                            |
            Summary|-fcompare-debug failure with|[4.6 Regression] -fcompare-
                   |uninitialized read in       |debug failure with
                   |walk_gimple_stmt            |uninitialized read in
                   |                            |walk_gimple_stmt


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


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

* [Bug debug/44971] [4.6 Regression] -fcompare-debug failure with uninitialized read in walk_gimple_stmt
  2010-07-17 11:44 [Bug debug/44971] New: -fcompare-debug failure with uninitialized read in walk_gimple_stmt zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2010-07-18 17:50 ` [Bug debug/44971] [4.6 Regression] " rguenth at gcc dot gnu dot org
@ 2010-07-18 20:47 ` rguenth at gcc dot gnu dot org
  2010-07-19 13:40 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-18 20:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rguenth at gcc dot gnu dot org  2010-07-18 20:46 -------
@@ -29,7 +29,7 @@
 (note# 0 0 NOTE_INSN_DELETED)
 (note# 0 0 [bb 2] NOTE_INSN_BASIC_BLOCK)
 (note# 0 0 NOTE_INSN_FUNCTION_BEG)
-(insn:TI# 0 0 pr44971.c:22 (set (reg/f:SI 0 ax [orig:58 D.xxxx ] [58])
+(insn:TI# 0 0 pr44971.c:22 (set (reg/v/f:SI 0 ax [orig:58 info ] [58])
         (mem/f/c:SI (symbol_ref:SI ("_XftintInfo")  <var_decl # _XftintInfo>)
[ MEM[(struct XftintInfo * *)&_XftintInfo]+0 S4 A32]))# {*movsi_internal}
(nil))
 (insn/f:TI# 0 0 pr44971.c:20 (set (mem:SI (pre_dec:SI (reg/f:SI 7 sp)) [ S4
A8])
         (reg/f:SI 6 bp))# {*pushsi2} (nil))
@@ -37,7 +37,7 @@
         (reg/f:SI 7 sp))# {*movsi_internal} (nil))
 (note# 0 0 NOTE_INSN_PROLOGUE_END)
 (insn:TI# 0 0 pr44971.c:22 (set (reg:CCZ 17 flags)
-        (compare:CCZ (reg/f:SI 0 ax [orig:58 D.xxxx ] [58])
+        (compare:CCZ (reg/v/f:SI 0 ax [orig:58 info ] [58])
             (const_int 0 [0])))# {*cmpsi_ccno_1} (nil))
 (jump_insn:TI# 0 0 pr44971.c:22 (set (pc)
         (if_then_else (eq (reg:CCZ 17 flags)
...

caused by phiprop.  It chooses one dereference result to choose the
result.  But debug stmts change order of immediate uses.

With debug stmts (uses of prev_1):

# VUSE <.MEM_8(D)>
info_5 = *prev_1;
# DEBUG prev => prev_1
# VUSE <.MEM_8(D)>
D.1973_6 = *prev_1;

without:

# VUSE <.MEM_8(D)>
D.1973_6 = *prev_1;
# VUSE <.MEM_8(D)>
info_5 = *prev_1;

so relying on stable order of immediate uses is now wrong?  The compare-debug
failure is spurious, there is no difference in the assembly output.
I can fix it by always degrading debug info and creating a new variable.

Alex, why should the immediate use lists show this behavior?


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu dot
                   |                            |org


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


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

* [Bug debug/44971] [4.6 Regression] -fcompare-debug failure with uninitialized read in walk_gimple_stmt
  2010-07-17 11:44 [Bug debug/44971] New: -fcompare-debug failure with uninitialized read in walk_gimple_stmt zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2010-07-18 20:47 ` rguenth at gcc dot gnu dot org
@ 2010-07-19 13:40 ` rguenth at gcc dot gnu dot org
  2010-07-19 16:05 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-19 13:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2010-07-19 13:40 -------
The difference starts to appear with .030t.ealias, where with debug info
we get a massive re-ordering of immediate uses (diff from .029t.forwprop1):

 prev_1 : -->2 uses.
-D.2738_7 = *prev_1;
 info_6 = *prev_1;
 # DEBUG prev => prev_1
+D.2738_7 = *prev_1;

 dpy_2(D) : --> no uses.
 # DEBUG D#1 => (long int) dpy_2(D)

 info_6 : --> single use.
-if (info_6 != 0B)
 # DEBUG info => info_6
+if (info_6 != 0B)

 D.2738_7 : --> single use.
 prev_8 = &D.2738_7->next;

 prev_8 : --> single use.
-prev_1 = PHI <&_XftintInfo(2), prev_8(3)>
 # DEBUG prev => prev_8
+prev_1 = PHI <&_XftintInfo(2), prev_8(3)>

 .MEM_9(D) : -->2 uses.
 # VUSE <.MEM_9(D)>
-D.2738_7 = *prev_1;
-# VUSE <.MEM_9(D)>
 info_6 = *prev_1;
+# VUSE <.MEM_9(D)>
+D.2738_7 = *prev_1;

Caused by the additional

+No longer having address taken event_base
+
+
+Symbols to be put in SSA form
+
+{ event_base }
+
+
+Incremental SSA update started at block: 0
+

in the debug enabled build (TODO_update_address_taken).  Still
in referenced-vars but only for the debug-enabled build
(it is in fact never added for the -g0 build, added by
remap_decl called from remap_block during inlining).

I may have a patch.


-- 


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


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

* [Bug debug/44971] [4.6 Regression] -fcompare-debug failure with uninitialized read in walk_gimple_stmt
  2010-07-17 11:44 [Bug debug/44971] New: -fcompare-debug failure with uninitialized read in walk_gimple_stmt zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2010-07-19 13:40 ` rguenth at gcc dot gnu dot org
@ 2010-07-19 16:05 ` rguenth at gcc dot gnu dot org
  2010-07-20 11:29 ` rguenth at gcc dot gnu dot org
  2010-07-20 11:30 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-19 16:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2010-07-19 16:04 -------
Bah, iterating over cfun->local_decls plus DECL_ARGUMENTS doesn't work because
with IPA-SRA DECL_ARGUMENTs are not in referenced-vars.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jamborm at gcc dot gnu dot
                   |                            |org


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


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

* [Bug debug/44971] [4.6 Regression] -fcompare-debug failure with uninitialized read in walk_gimple_stmt
  2010-07-17 11:44 [Bug debug/44971] New: -fcompare-debug failure with uninitialized read in walk_gimple_stmt zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2010-07-19 16:05 ` rguenth at gcc dot gnu dot org
@ 2010-07-20 11:29 ` rguenth at gcc dot gnu dot org
  2010-07-20 11:30 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-20 11:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from rguenth at gcc dot gnu dot org  2010-07-20 11:29 -------
Subject: Bug 44971

Author: rguenth
Date: Tue Jul 20 11:28:56 2010
New Revision: 162329

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162329
Log:
2010-07-20  Richard Guenther  <rguenther@suse.de>

        PR middle-end/44971
        PR middle-end/44988
        * tree-ssa.c (maybe_optimize_var): New function split out from ...
        (execute_update_addresses_taken): ... here.
        (non_rewritable_mem_ref_base): Likewise.
        (execute_update_addresses_taken): Do not iterate over all referenced
        vars but just all local decls and parms.
        Properly check call and asm arguments and rewrite call arguments.

        * gcc.dg/pr44971.c: New testcase.
        * gcc.c-torture/compile/pr44988.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr44988.c
    trunk/gcc/testsuite/gcc.dg/pr44971.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa.c


-- 


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


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

* [Bug debug/44971] [4.6 Regression] -fcompare-debug failure with uninitialized read in walk_gimple_stmt
  2010-07-17 11:44 [Bug debug/44971] New: -fcompare-debug failure with uninitialized read in walk_gimple_stmt zsojka at seznam dot cz
                   ` (7 preceding siblings ...)
  2010-07-20 11:29 ` rguenth at gcc dot gnu dot org
@ 2010-07-20 11:30 ` rguenth at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-07-20 11:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2010-07-20 11:29 -------
Fixed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2010-07-20 11:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-17 11:44 [Bug debug/44971] New: -fcompare-debug failure with uninitialized read in walk_gimple_stmt zsojka at seznam dot cz
2010-07-17 11:46 ` [Bug debug/44971] " zsojka at seznam dot cz
2010-07-17 13:37 ` hjl dot tools at gmail dot com
2010-07-17 13:38 ` hjl dot tools at gmail dot com
2010-07-18 17:50 ` [Bug debug/44971] [4.6 Regression] " rguenth at gcc dot gnu dot org
2010-07-18 20:47 ` rguenth at gcc dot gnu dot org
2010-07-19 13:40 ` rguenth at gcc dot gnu dot org
2010-07-19 16:05 ` rguenth at gcc dot gnu dot org
2010-07-20 11:29 ` rguenth at gcc dot gnu dot org
2010-07-20 11:30 ` rguenth 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).