All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memops.c: always true expression
@ 2010-11-21 20:25 Nicolas Kaiser
  2010-11-23 10:10 ` Christopher Li
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Kaiser @ 2010-11-21 20:25 UTC (permalink / raw)
  To: Christopher Li; +Cc: linux-sparse

I noticed that the second part of this conditional is always true.
Just a shot in the dark: Could that be a typo?

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
 memops.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/memops.c b/memops.c
index 9eafb72..45bd340 100644
--- a/memops.c
+++ b/memops.c
@@ -69,7 +69,7 @@ static int address_taken(pseudo_t pseudo)
 	struct pseudo_user *pu;
 	FOR_EACH_PTR(pseudo->users, pu) {
 		struct instruction *insn = pu->insn;
-		if (insn->bb && (insn->opcode != OP_LOAD || insn->opcode != OP_STORE))
+		if (insn->bb && (insn->opcode != OP_LOAD && insn->opcode != OP_STORE))
 			return 1;
 	} END_FOR_EACH_PTR(pu);
 	return 0;
-- 
1.7.2.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] memops.c: always true expression
  2010-11-21 20:25 [PATCH] memops.c: always true expression Nicolas Kaiser
@ 2010-11-23 10:10 ` Christopher Li
  2010-11-23 14:50   ` Anderson Lizardo
  0 siblings, 1 reply; 3+ messages in thread
From: Christopher Li @ 2010-11-23 10:10 UTC (permalink / raw)
  To: Nicolas Kaiser; +Cc: linux-sparse

On Sun, Nov 21, 2010 at 12:25 PM, Nicolas Kaiser <nikai@nikai.net> wrote:
> I noticed that the second part of this conditional is always true.
> Just a shot in the dark: Could that be a typo?
> -               if (insn->bb && (insn->opcode != OP_LOAD || insn->opcode != OP_STORE))
> +               if (insn->bb && (insn->opcode != OP_LOAD && insn->opcode != OP_STORE))

I think you are right. The insn->opcode can't be both OP_LOAD and OP_STORE.

The fix seems right to me. That is a good catch.

Thanks

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] memops.c: always true expression
  2010-11-23 10:10 ` Christopher Li
@ 2010-11-23 14:50   ` Anderson Lizardo
  0 siblings, 0 replies; 3+ messages in thread
From: Anderson Lizardo @ 2010-11-23 14:50 UTC (permalink / raw)
  To: Christopher Li; +Cc: Nicolas Kaiser, linux-sparse

On Tue, Nov 23, 2010 at 6:10 AM, Christopher Li <sparse@chrisli.org> wrote:
> On Sun, Nov 21, 2010 at 12:25 PM, Nicolas Kaiser <nikai@nikai.net> wrote:
>> I noticed that the second part of this conditional is always true.
>> Just a shot in the dark: Could that be a typo?
>> -               if (insn->bb && (insn->opcode != OP_LOAD || insn->opcode != OP_STORE))
>> +               if (insn->bb && (insn->opcode != OP_LOAD && insn->opcode != OP_STORE))
>
> I think you are right. The insn->opcode can't be both OP_LOAD and OP_STORE.
>
> The fix seems right to me. That is a good catch.

I wonder if running sparse on it could catch this...

Regards,
-- 
Anderson Lizardo
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-23 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-21 20:25 [PATCH] memops.c: always true expression Nicolas Kaiser
2010-11-23 10:10 ` Christopher Li
2010-11-23 14:50   ` Anderson Lizardo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.