diff mbox

Assume PATTERN is always non-NULL in sched-deps.c (PR middle-end/51986)

Message ID 20120125201042.GE18768@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Jan. 25, 2012, 8:10 p.m. UTC
Hi!

This PR is about a warning that rev may be used uninitialized when
sched_get_condition_with_rev_uncached is inlined into its caller.
It in fact may be used uninitialized if PATTERN (insn) is ever NULL.
But IMNSHO everything in the compiler assumes that PATTERN of an insn
is always non-NULL, so IMHO instead of just moving the
if (rev) *rev = false; hunk above the test we should just remove this test.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2012-01-25  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/51986
	* sched-deps.c (sched_get_condition_with_rev_uncached): Don't test
	for pat == 0.


	Jakub

Comments

Vladimir Makarov Jan. 25, 2012, 8:19 p.m. UTC | #1
On 01/25/2012 03:10 PM, Jakub Jelinek wrote:
> Hi!
>
> This PR is about a warning that rev may be used uninitialized when
> sched_get_condition_with_rev_uncached is inlined into its caller.
> It in fact may be used uninitialized if PATTERN (insn) is ever NULL.
> But IMNSHO everything in the compiler assumes that PATTERN of an insn
> is always non-NULL, so IMHO instead of just moving the
> if (rev) *rev = false; hunk above the test we should just remove this test.
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2012-01-25  Jakub Jelinek<jakub@redhat.com>
>
> 	PR middle-end/51986
> 	* sched-deps.c (sched_get_condition_with_rev_uncached): Don't test
> 	for pat == 0.
>
> --- gcc/sched-deps.c.jj	2011-12-01 11:45:06.000000000 +0100
> +++ gcc/sched-deps.c	2012-01-25 15:27:49.523165701 +0100
> @@ -521,9 +521,6 @@ sched_get_condition_with_rev_uncached (c
>     rtx pat = PATTERN (insn);
>     rtx src;
>
> -  if (pat == 0)
> -    return 0;
> -
>     if (rev)
>       *rev = false;
>
Ok.  Thanks, Jakub.
diff mbox

Patch

--- gcc/sched-deps.c.jj	2011-12-01 11:45:06.000000000 +0100
+++ gcc/sched-deps.c	2012-01-25 15:27:49.523165701 +0100
@@ -521,9 +521,6 @@  sched_get_condition_with_rev_uncached (c
   rtx pat = PATTERN (insn);
   rtx src;
 
-  if (pat == 0)
-    return 0;
-
   if (rev)
     *rev = false;