Bug 45055 - [4.5/4.6 Regression] another -fcompare-debug failure with uninitialised read in walk_gimple_stmt
Summary: [4.5/4.6 Regression] another -fcompare-debug failure with uninitialised read ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.5.2
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-24 13:00 UTC by Zdenek Sojka
Modified: 2010-08-12 09:32 UTC (History)
2 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
reduced testcase (248 bytes, text/plain)
2010-07-24 13:01 UTC, Zdenek Sojka
Details
gcc46-pr45055.patch (2.50 KB, patch)
2010-07-30 11:57 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2010-07-24 13:00:32 UTC
Command line:
$ gcc -fcompare-debug testcase.c -O2 -ftracer -fsched-pressure -funroll-loops -fschedule-insns

Output with valgrind:
$ valgrind -q --trace-children=yes /mnt/svn/gcc-trunk/binary-162456-lto-fortran-checking-yes-rtl-df/bin/gcc -O2 -ftracer -fsched-pressure -funroll-loops -fschedule-insns -fcompare-debug testcase.c
==25565== Conditional jump or move depends on uninitialised value(s)
==25565==    at 0x70DD7B: walk_gimple_stmt (gimple.c:1629)
==25565==    by 0x95A913: dump_enumerated_decls (tree-ssa-live.c:1264)
==25565==    by 0x8FD118: execute_cleanup_cfg_post_optimizing (tree-optimize.c:214)
==25565==    by 0x7BB16D: execute_one_pass (passes.c:1563)
==25565==    by 0x7BB404: execute_pass_list (passes.c:1618)
==25565==    by 0x8FDAA5: tree_rest_of_compilation (tree-optimize.c:452)
==25565==    by 0xAB4C75: cgraph_expand_function (cgraphunit.c:1643)
==25565==    by 0xAB7B09: cgraph_optimize (cgraphunit.c:1722)
==25565==    by 0xAB80FA: cgraph_finalize_compilation_unit (cgraphunit.c:1185)
==25565==    by 0x4DF3EE: c_write_global_declarations (c-decl.c:9698)
==25565==    by 0x8A91F5: toplev_main (toplev.c:990)
==25565==    by 0x6589BBC: (below main) (in /lib64/libc-2.11.2.so)
==25565== 
==26524== Conditional jump or move depends on uninitialised value(s)
==26524==    at 0x70DD7B: walk_gimple_stmt (gimple.c:1629)
==26524==    by 0x95A913: dump_enumerated_decls (tree-ssa-live.c:1264)
==26524==    by 0x8FD118: execute_cleanup_cfg_post_optimizing (tree-optimize.c:214)
==26524==    by 0x7BB16D: execute_one_pass (passes.c:1563)
==26524==    by 0x7BB404: execute_pass_list (passes.c:1618)
==26524==    by 0x8FDAA5: tree_rest_of_compilation (tree-optimize.c:452)
==26524==    by 0xAB4C75: cgraph_expand_function (cgraphunit.c:1643)
==26524==    by 0xAB7B09: cgraph_optimize (cgraphunit.c:1722)
==26524==    by 0xAB80FA: cgraph_finalize_compilation_unit (cgraphunit.c:1185)
==26524==    by 0x4DF3EE: c_write_global_declarations (c-decl.c:9698)
==26524==    by 0x8A91F5: toplev_main (toplev.c:990)
==26524==    by 0x6589BBC: (below main) (in /lib64/libc-2.11.2.so)
==26524== 
gcc: error: testcase.c: -fcompare-debug failure (length)

The uninitialised read is probably not related, testcase fails in older revisions, where this valgrind warning isn't present.

Tested revisions:
r162456 - fail
r162222 - fail
r159696 - fail
r153685 - fail
Comment 1 Zdenek Sojka 2010-07-24 13:01:32 UTC
Created attachment 21299 [details]
reduced testcase

Command line:
$ gcc -O2 -ftracer -fsched-pressure -funroll-loops -fschedule-insns -fcompare-debug pr45055.c 
gcc: error: pr45055.c: -fcompare-debug failure (length)
Comment 2 Jakub Jelinek 2010-07-30 11:57:48 UTC
Created attachment 21359 [details]
gcc46-pr45055.patch

So far untested fix.
Comment 3 Jakub Jelinek 2010-07-30 14:37:12 UTC
Subject: Bug 45055

Author: jakub
Date: Fri Jul 30 14:36:56 2010
New Revision: 162714

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162714
Log:
	PR debug/45055
	PR rtl-optimization/45137
	* rtl.h (prev_nonnote_nondebug_insn, next_nonnote_nondebug_insn): New
	prototypes.
	* emit-rtl.c (prev_nonnote_nondebug_insn, next_nonnote_nondebug_insn):
	New functions.
	* combine.c (next_nonnote_nondebug_insn): Removed.
	* ifcvt.c (noce_process_if_block): Use prev_nonnote_nondebug_insn.
	* haifa-sched.c (queue_to_ready): Use next_nonnote_nondebug_insn.
	* sched-deps.c (sched_analyze_insn): Likewise.
	(fixup_sched_groups, deps_start_bb): Use prev_nonnote_nondebug_insn.
	* rtlanal.c (canonicalize_condition): Likewise.
	* postreload.c (reload_combine_recognize_pattern): Likewise.
	(reload_cse_move2add): Use next_nonnote_nondebug_insn.

	* gcc.dg/pr45055.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr45055.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/emit-rtl.c
    trunk/gcc/haifa-sched.c
    trunk/gcc/ifcvt.c
    trunk/gcc/postreload.c
    trunk/gcc/rtl.h
    trunk/gcc/rtlanal.c
    trunk/gcc/sched-deps.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Jakub Jelinek 2010-07-30 15:57:44 UTC
Fixed on the trunk, will backport to 4.5.2 once 4.5.1 is released.
Comment 5 Jakub Jelinek 2010-08-12 09:15:05 UTC
Subject: Bug 45055

Author: jakub
Date: Thu Aug 12 09:14:47 2010
New Revision: 163187

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163187
Log:
	Backport from mainline
	2010-07-30  Jakub Jelinek  <jakub@redhat.com>

	PR debug/45055
	PR rtl-optimization/45137
	* rtl.h (prev_nonnote_nondebug_insn, next_nonnote_nondebug_insn): New
	prototypes.
	* emit-rtl.c (prev_nonnote_nondebug_insn, next_nonnote_nondebug_insn):
	New functions.
	* combine.c (next_nonnote_nondebug_insn): Removed.
	* ifcvt.c (noce_process_if_block): Use prev_nonnote_nondebug_insn.
	* haifa-sched.c (queue_to_ready): Use next_nonnote_nondebug_insn.
	* sched-deps.c (sched_analyze_insn): Likewise.
	(fixup_sched_groups, deps_start_bb): Use prev_nonnote_nondebug_insn.
	* rtlanal.c (canonicalize_condition): Likewise.
	* postreload.c (reload_combine): Likewise.
	(reload_cse_move2add): Use next_nonnote_nondebug_insn.

	* gcc.dg/pr45055.c: New test.

Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/pr45055.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/combine.c
    branches/gcc-4_5-branch/gcc/emit-rtl.c
    branches/gcc-4_5-branch/gcc/haifa-sched.c
    branches/gcc-4_5-branch/gcc/ifcvt.c
    branches/gcc-4_5-branch/gcc/postreload.c
    branches/gcc-4_5-branch/gcc/rtl.h
    branches/gcc-4_5-branch/gcc/rtlanal.c
    branches/gcc-4_5-branch/gcc/sched-deps.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog

Comment 6 Jakub Jelinek 2010-08-12 09:32:44 UTC
Fixed.