public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns
@ 2010-03-11 15:11 zsojka at seznam dot cz
2010-03-13 2:52 ` [Bug rtl-optimization/43332] " pinskia at gcc dot gnu dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-03-11 15:11 UTC (permalink / raw)
To: gcc-bugs
This can be related to pr42941
Command line:
gcc -fschedule-insns -fsched-pressure testcase.c
---- testcase.c ----
extern void exit(int);
int main(int argc, char *argv[])
{
exit(0);
}
--------------------
gcc has to be compiled with valgrind checking to show this warning:
$ valgrind -q --track-origins=yes
/mnt/sdb1/build-157335-lto-checking-valgrind/gcc/cc1 -fschedule-insns
-fsched-pressure testcase.c -quiet
==26448== Conditional jump or move depends on uninitialised value(s)
==26448== at 0xACFEE7: setup_insn_max_reg_pressure (haifa-sched.c:1589)
==26448== by 0x6CFA41: schedule_insns (sched-rgn.c:2965)
==26448== by 0x6CFC2D: rest_of_handle_sched (sched-rgn.c:3512)
==26448== by 0x679D8D: execute_one_pass (passes.c:1567)
==26448== by 0x679FF4: execute_pass_list (passes.c:1622)
==26448== by 0x67A006: execute_pass_list (passes.c:1623)
==26448== by 0x749E2F: tree_rest_of_compilation (tree-optimize.c:413)
==26448== by 0x876780: cgraph_expand_function (cgraphunit.c:1545)
==26448== by 0x87717F: cgraph_output_in_order (cgraphunit.c:1721)
==26448== by 0x8789D5: cgraph_optimize (cgraphunit.c:1869)
==26448== by 0x878BD4: cgraph_finalize_compilation_unit (cgraphunit.c:1093)
==26448== by 0x4A78CA: c_write_global_declarations (c-decl.c:9510)
==26448== Uninitialised value was created by a client request
==26448== at 0x4FC1AF: ggc_alloc_stat (ggc-page.c:1228)
==26448== by 0x6C06E0: rtx_alloc_stat (rtl.c:199)
==26448== by 0x597FDA: emit_barrier_after (emit-rtl.c:4481)
==26448== by 0x525B7A: expand_call (calls.c:2911)
==26448== by 0x50F2ED: expand_builtin (builtins.c:6403)
==26448== by 0x5AFF20: expand_expr_real_1 (expr.c:9247)
==26448== by 0x52E2EB: expand_gimple_stmt (cfgexpand.c:1783)
==26448== by 0x52F0D7: expand_gimple_basic_block (cfgexpand.c:3377)
==26448== by 0x532847: gimple_expand_cfg (cfgexpand.c:3826)
==26448== by 0x679D8D: execute_one_pass (passes.c:1567)
==26448== by 0x679FF4: execute_pass_list (passes.c:1622)
==26448== by 0x749E2F: tree_rest_of_compilation (tree-optimize.c:413)
==26448==
==26448== Conditional jump or move depends on uninitialised value(s)
==26448== at 0xACFEE7: setup_insn_max_reg_pressure (haifa-sched.c:1589)
==26448== by 0xAD4E42: schedule_insn (haifa-sched.c:1632)
==26448== by 0xAD7598: schedule_block (haifa-sched.c:3143)
==26448== by 0x6CFAA9: schedule_insns (sched-rgn.c:3001)
==26448== by 0x6CFC2D: rest_of_handle_sched (sched-rgn.c:3512)
==26448== by 0x679D8D: execute_one_pass (passes.c:1567)
==26448== by 0x679FF4: execute_pass_list (passes.c:1622)
==26448== by 0x67A006: execute_pass_list (passes.c:1623)
==26448== by 0x749E2F: tree_rest_of_compilation (tree-optimize.c:413)
==26448== by 0x876780: cgraph_expand_function (cgraphunit.c:1545)
==26448== by 0x87717F: cgraph_output_in_order (cgraphunit.c:1721)
==26448== by 0x8789D5: cgraph_optimize (cgraphunit.c:1869)
==26448== Uninitialised value was created by a client request
==26448== at 0x4FC1AF: ggc_alloc_stat (ggc-page.c:1228)
==26448== by 0x6C06E0: rtx_alloc_stat (rtl.c:199)
==26448== by 0x597FDA: emit_barrier_after (emit-rtl.c:4481)
==26448== by 0x525B7A: expand_call (calls.c:2911)
==26448== by 0x50F2ED: expand_builtin (builtins.c:6403)
==26448== by 0x5AFF20: expand_expr_real_1 (expr.c:9247)
==26448== by 0x52E2EB: expand_gimple_stmt (cfgexpand.c:1783)
==26448== by 0x52F0D7: expand_gimple_basic_block (cfgexpand.c:3377)
==26448== by 0x532847: gimple_expand_cfg (cfgexpand.c:3826)
==26448== by 0x679D8D: execute_one_pass (passes.c:1567)
==26448== by 0x679FF4: execute_pass_list (passes.c:1622)
==26448== by 0x749E2F: tree_rest_of_compilation (tree-optimize.c:413)
==26448==
--
Summary: valgrind warns about using uninitialized variable with -
fsched-pressure -fschedule-insns
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=43332
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/43332] valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns
2010-03-11 15:11 [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns zsojka at seznam dot cz
@ 2010-03-13 2:52 ` pinskia at gcc dot gnu dot org
2010-03-13 9:20 ` zsojka at seznam dot cz
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-13 2:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2010-03-13 02:51 -------
It is the same and was fixed by the same patch.
*** This bug has been marked as a duplicate of 42941 ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |DUPLICATE
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43332
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/43332] valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns
2010-03-11 15:11 [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns zsojka at seznam dot cz
2010-03-13 2:52 ` [Bug rtl-optimization/43332] " pinskia at gcc dot gnu dot org
@ 2010-03-13 9:20 ` zsojka at seznam dot cz
2010-05-17 18:46 ` zsojka at seznam dot cz
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-03-13 9:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from zsojka at seznam dot cz 2010-03-13 09:19 -------
Thank you for feedback. However, this happens in r157335, so it's not fixed by
that patch. It's only reproducible with valgrind checking because
ggc_alloc_stat() uses VALGRIND_DISCARD which is a no-op in other cases. When
valgrind checking is enabled, it marks memory as uninitialised, even when
malloc() isn't used to allocate it (some custom memory allocation is done).
That's why "Uninitialised value was created by a client request" is printed in
the "where does uninitialised memory come from?" part of the message.
I don't know if this is a real issue, or the result doesn't depend on this
uninitialised read (because further test it the condition will be false
anyway).
--
zsojka at seznam dot cz changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|DUPLICATE |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43332
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/43332] valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns
2010-03-11 15:11 [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns zsojka at seznam dot cz
2010-03-13 2:52 ` [Bug rtl-optimization/43332] " pinskia at gcc dot gnu dot org
2010-03-13 9:20 ` zsojka at seznam dot cz
@ 2010-05-17 18:46 ` zsojka at seznam dot cz
2010-05-18 21:40 ` vmakarov at redhat dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-05-17 18:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from zsojka at seznam dot cz 2010-05-17 18:45 -------
Stil appears in r159500, x86_64-linux.
Uninitialised read is at gcc/haifa-sched.c:1589, more exactly it is read of
BLOCK_FOR_INSN (insn)
When gcc/haifa-sched.c:1589 is changed to:
insn != NULL_RTX && (printf("%p %p\n", (void *)BLOCK_FOR_INSN (insn), (void
*)BLOCK_FOR_INSN (after)), BLOCK_FOR_INSN (insn) == BLOCK_FOR_INSN (after));
it outputs (for original testcase):
$ /mnt/sda1/build-159500-test/gcc/cc1 -fschedule-insns -fsched-pressure
testcase.c -quiet
0x7fcc29e98270 0x7fcc29e98270
0x7fcc29e98270 0x7fcc29e98270
0x7fcc29e98270 0x7fcc29e98270
0x7fcc29e98270 0x7fcc29e98270
0x7fcc29e98270 0x7fcc29e98270
0xafafafafafafafaf 0x7fcc29e98270
0x7fcc29e98270 0x7fcc29e98270
0x7fcc29e98270 0x7fcc29e98270
0x7fcc29e98270 0x7fcc29e98270
0xafafafafafafafaf 0x7fcc29e98270
0x7fcc29e98270 0x7fcc29e98270
0x7fcc29e98270 0x7fcc29e98270
0x7fcc29e98270 0x7fcc29e98270
0xafafafafafafafaf 0x7fcc29e98270
However, I wasn't able to cause any difference in generated code even for more
complex testcases, when the condition is "true" for "BLOCK_FOR_INSN (insn) ==
0xafafafafafafafaf" - that is, the uninitialised value is the same as
BLOCK_FOR_INSN (after) "by luck".
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43332
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/43332] valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns
2010-03-11 15:11 [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns zsojka at seznam dot cz
` (2 preceding siblings ...)
2010-05-17 18:46 ` zsojka at seznam dot cz
@ 2010-05-18 21:40 ` vmakarov at redhat dot com
2010-05-18 22:09 ` vmakarov at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: vmakarov at redhat dot com @ 2010-05-18 21:40 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from vmakarov at redhat dot com 2010-05-18 21:40 -------
Thanks for reporting the problem. The problem has no effect on generated
code whatever initialization is used. The code in question tries to get basic
block for BARRIER which is wrong. Whatever it gets basic block for BARRIER the
code will still work right.
In any case, it is really annoying to see such valgrind diagnostic.
Therefore I'll send a patch to fix it soon.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43332
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/43332] valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns
2010-03-11 15:11 [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns zsojka at seznam dot cz
` (3 preceding siblings ...)
2010-05-18 21:40 ` vmakarov at redhat dot com
@ 2010-05-18 22:09 ` vmakarov at gcc dot gnu dot org
2010-05-18 22:22 ` zsojka at seznam dot cz
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: vmakarov at gcc dot gnu dot org @ 2010-05-18 22:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from vmakarov at gcc dot gnu dot org 2010-05-18 22:09 -------
Subject: Bug 43332
Author: vmakarov
Date: Tue May 18 22:09:19 2010
New Revision: 159545
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159545
Log:
2010-05-18 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/43332
* haifa-sched.c (setup_insn_max_reg_pressure): Check barrier.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/haifa-sched.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43332
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/43332] valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns
2010-03-11 15:11 [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns zsojka at seznam dot cz
` (4 preceding siblings ...)
2010-05-18 22:09 ` vmakarov at gcc dot gnu dot org
@ 2010-05-18 22:22 ` zsojka at seznam dot cz
2010-06-09 10:15 ` zsojka at seznam dot cz
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-05-18 22:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from zsojka at seznam dot cz 2010-05-18 22:22 -------
Thank you for fixing this. I hope to rebuild gcc with valgrind checking in few
days again.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43332
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/43332] valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns
2010-03-11 15:11 [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns zsojka at seznam dot cz
` (5 preceding siblings ...)
2010-05-18 22:22 ` zsojka at seznam dot cz
@ 2010-06-09 10:15 ` zsojka at seznam dot cz
2010-06-10 15:45 ` zsojka at seznam dot cz
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-06-09 10:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from zsojka at seznam dot cz 2010-06-09 10:14 -------
I have just finished bootstrap of r160198 with valgrind checking, the problem
is no longer reproducible there. I am sorry for the delay, make check with
valgrind checking takes about a month there (1.3GHz), bootstrap about a week...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43332
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/43332] valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns
2010-03-11 15:11 [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns zsojka at seznam dot cz
` (6 preceding siblings ...)
2010-06-09 10:15 ` zsojka at seznam dot cz
@ 2010-06-10 15:45 ` zsojka at seznam dot cz
2010-06-27 8:28 ` ebotcazou at gcc dot gnu dot org
2010-06-27 8:31 ` ebotcazou at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-06-10 15:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from zsojka at seznam dot cz 2010-06-10 15:45 -------
Is there a chance this will be backported to 4.5? As Jakub pointed out at
PR44178/comment #7, gcc 4.5 r160526 (with RTL checking) fails on this testcase
with:
$ gcc -fsched-pressure -fschedule-insns pr43332/testcase.c
pr43332/testcase.c: In function ‘main’:
pr43332/testcase.c:5:1: internal compiler error: RTL check: expected elt 3 type
'B', have '0' (rtx barrier) in setup_insn_max_reg_pressure, at
haifa-sched.c:1589
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
It also fails on testsuite/g++.dg/debug/pr44178.C when built with RTL checking.
When r159545 is backported to 4.5, everything works fine.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43332
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/43332] valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns
2010-03-11 15:11 [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns zsojka at seznam dot cz
` (7 preceding siblings ...)
2010-06-10 15:45 ` zsojka at seznam dot cz
@ 2010-06-27 8:28 ` ebotcazou at gcc dot gnu dot org
2010-06-27 8:31 ` ebotcazou at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2010-06-27 8:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from ebotcazou at gcc dot gnu dot org 2010-06-27 08:27 -------
Subject: Bug 43332
Author: ebotcazou
Date: Sun Jun 27 08:27:39 2010
New Revision: 161459
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161459
Log:
Backport from mainline
2010-05-18 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/43332
* haifa-sched.c (setup_insn_max_reg_pressure): Check barrier.
Modified:
branches/gcc-4_5-branch/gcc/ChangeLog
branches/gcc-4_5-branch/gcc/haifa-sched.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43332
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug rtl-optimization/43332] valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns
2010-03-11 15:11 [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns zsojka at seznam dot cz
` (8 preceding siblings ...)
2010-06-27 8:28 ` ebotcazou at gcc dot gnu dot org
@ 2010-06-27 8:31 ` ebotcazou at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2010-06-27 8:31 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from ebotcazou at gcc dot gnu dot org 2010-06-27 08:31 -------
Trivial fixes like this should be installed at the same time on branches.
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ebotcazou at gcc dot gnu dot
| |org
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.5.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43332
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-06-27 8:31 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-11 15:11 [Bug rtl-optimization/43332] New: valgrind warns about using uninitialized variable with -fsched-pressure -fschedule-insns zsojka at seznam dot cz
2010-03-13 2:52 ` [Bug rtl-optimization/43332] " pinskia at gcc dot gnu dot org
2010-03-13 9:20 ` zsojka at seznam dot cz
2010-05-17 18:46 ` zsojka at seznam dot cz
2010-05-18 21:40 ` vmakarov at redhat dot com
2010-05-18 22:09 ` vmakarov at gcc dot gnu dot org
2010-05-18 22:22 ` zsojka at seznam dot cz
2010-06-09 10:15 ` zsojka at seznam dot cz
2010-06-10 15:45 ` zsojka at seznam dot cz
2010-06-27 8:28 ` ebotcazou at gcc dot gnu dot org
2010-06-27 8:31 ` ebotcazou 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).