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

login
register
mail settings
Submitter Jakub Jelinek
Date Jan. 25, 2012, 8:10 p.m.
Message ID <20120125201042.GE18768@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/137853/
State New
Headers show

Comments

Jakub Jelinek - Jan. 25, 2012, 8:10 p.m.
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
Vladimir Makarov - Jan. 25, 2012, 8:19 p.m.
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.

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;