public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/61328] New: valgrind finds problem in find_bswap_or_nop_1
@ 2014-05-27 7:46 dcb314 at hotmail dot com
2014-05-27 9:20 ` [Bug c/61328] " thomas.preudhomme at arm dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2014-05-27 7:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61328
Bug ID: 61328
Summary: valgrind finds problem in find_bswap_or_nop_1
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Created attachment 32859
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32859&action=edit
C source code
I just compiled the attached code with gcc trunk 20140526 with flag -O2 under
valgrind and it said
==24014== Conditional jump or move depends on uninitialised value(s)
==24014== at 0xA8F1F5: find_bswap_or_nop_1(gimple_statement_base*,
symbolic_number*, int) (tree-ssa-math-opts.c:1918)
==24014== by 0xA8FD14: (anonymous
namespace)::pass_optimize_bswap::execute(function*) (tree-ssa-math-opts.c:2034)
==24014== by 0x8AA350: execute_one_pass(opt_pass*) (passes.c:2180)
==24014== by 0x8AAAF7: execute_pass_list_1(opt_pass*) (passes.c:2233)
==24014== by 0x8AADC7: execute_pass_list(function*, opt_pass*)
(passes.c:2234)
==24014== by 0x64757C: expand_function(cgraph_node*) (cgraphunit.c:1783)
==24014== by 0x64926C: compile() [clone .part.31] (cgraphunit.c:1917)
tree-ssa-math-opts.c:1918 is
if (n1.size != n2.size || !source_expr2)
return NULL_TREE;
Maybe
if (!source_expr2)
return NULL_TREE;
if (n1.size != n2.size)
return NULL_TREE;
would be better code.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/61328] valgrind finds problem in find_bswap_or_nop_1
2014-05-27 7:46 [Bug c/61328] New: valgrind finds problem in find_bswap_or_nop_1 dcb314 at hotmail dot com
@ 2014-05-27 9:20 ` thomas.preudhomme at arm dot com
2014-05-27 9:59 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: thomas.preudhomme at arm dot com @ 2014-05-27 9:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61328
--- Comment #1 from Thomas Preud'homme <thomas.preudhomme at arm dot com> ---
*facepalm*
Yes indeed. Does this qualify for an obvious fix as per commiting rules?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/61328] valgrind finds problem in find_bswap_or_nop_1
2014-05-27 7:46 [Bug c/61328] New: valgrind finds problem in find_bswap_or_nop_1 dcb314 at hotmail dot com
2014-05-27 9:20 ` [Bug c/61328] " thomas.preudhomme at arm dot com
@ 2014-05-27 9:59 ` rguenth at gcc dot gnu.org
2014-05-28 15:08 ` dcb314 at hotmail dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-05-27 9:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61328
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Thomas Preud'homme from comment #1)
> *facepalm*
>
> Yes indeed. Does this qualify for an obvious fix as per commiting rules?
Yes.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/61328] valgrind finds problem in find_bswap_or_nop_1
2014-05-27 7:46 [Bug c/61328] New: valgrind finds problem in find_bswap_or_nop_1 dcb314 at hotmail dot com
2014-05-27 9:20 ` [Bug c/61328] " thomas.preudhomme at arm dot com
2014-05-27 9:59 ` rguenth at gcc dot gnu.org
@ 2014-05-28 15:08 ` dcb314 at hotmail dot com
2014-05-29 2:52 ` thomas.preudhomme at arm dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dcb314 at hotmail dot com @ 2014-05-28 15:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61328
--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #0)
> Maybe
>
> if (!source_expr2)
> return NULL_TREE;
>
> if (n1.size != n2.size)
> return NULL_TREE;
>
> would be better code.
I tried out my proposed solution and it didn't seem to help.
Current working assumption is that something somewhere isn't
setting the size field. Maybe blindly zeroing out the entire
struct might be a way forward.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/61328] valgrind finds problem in find_bswap_or_nop_1
2014-05-27 7:46 [Bug c/61328] New: valgrind finds problem in find_bswap_or_nop_1 dcb314 at hotmail dot com
` (2 preceding siblings ...)
2014-05-28 15:08 ` dcb314 at hotmail dot com
@ 2014-05-29 2:52 ` thomas.preudhomme at arm dot com
2014-06-03 9:29 ` [Bug tree-optimization/61328] " thopre01 at gcc dot gnu.org
2014-12-11 13:10 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: thomas.preudhomme at arm dot com @ 2014-05-29 2:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61328
--- Comment #4 from Thomas Preud'homme <thomas.preudhomme at arm dot com> ---
Oh I think I see. When I wrote find_bswap_or_nop_load () I assumed that it
would only return in find_bswap_or_nop_1 as called in the GIMPLE_UNARY_RHS
case. It seems I was wrong.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/61328] valgrind finds problem in find_bswap_or_nop_1
2014-05-27 7:46 [Bug c/61328] New: valgrind finds problem in find_bswap_or_nop_1 dcb314 at hotmail dot com
` (3 preceding siblings ...)
2014-05-29 2:52 ` thomas.preudhomme at arm dot com
@ 2014-06-03 9:29 ` thopre01 at gcc dot gnu.org
2014-12-11 13:10 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: thopre01 at gcc dot gnu.org @ 2014-06-03 9:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61328
--- Comment #5 from thopre01 at gcc dot gnu.org ---
Author: thopre01
Date: Tue Jun 3 09:29:06 2014
New Revision: 211166
URL: http://gcc.gnu.org/viewcvs?rev=211166&root=gcc&view=rev
Log:
2014-06-03 Thomas Preud'homme <thomas.preudhomme@arm.com>
PR tree-optimization/61328
* tree-ssa-math-opts.c (init_symbolic_number): Extract symbolic number
initialization from find_bswap_or_nop_1.
(find_bswap_or_nop_1): Test return value of find_bswap_or_nop_1 stored
in source_expr2 before using the size value the function sets. Also
make use of init_symbolic_number () in both the old place and
find_bswap_or_nop_load () to avoid reading uninitialized memory when
doing recursion in the GIMPLE_BINARY_RHS case.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/tree-ssa-math-opts.c
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug tree-optimization/61328] valgrind finds problem in find_bswap_or_nop_1
2014-05-27 7:46 [Bug c/61328] New: valgrind finds problem in find_bswap_or_nop_1 dcb314 at hotmail dot com
` (4 preceding siblings ...)
2014-06-03 9:29 ` [Bug tree-optimization/61328] " thopre01 at gcc dot gnu.org
@ 2014-12-11 13:10 ` mpolacek at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-12-11 13:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61328
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Assuming fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-12-11 13:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-27 7:46 [Bug c/61328] New: valgrind finds problem in find_bswap_or_nop_1 dcb314 at hotmail dot com
2014-05-27 9:20 ` [Bug c/61328] " thomas.preudhomme at arm dot com
2014-05-27 9:59 ` rguenth at gcc dot gnu.org
2014-05-28 15:08 ` dcb314 at hotmail dot com
2014-05-29 2:52 ` thomas.preudhomme at arm dot com
2014-06-03 9:29 ` [Bug tree-optimization/61328] " thopre01 at gcc dot gnu.org
2014-12-11 13:10 ` mpolacek 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).