Probable boolean logic error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Probable boolean logic error

Michael McConville
Currently, these conditions can never be true. It seems like || was
meant to be used instead of &&.

Thanks for your time,
Michael

--- misc/abx.c
+++ /tmp/cocci-output-38249-eb5652-abx.c
@@ -745,7 +745,7 @@ void testing ( const stereo_t* A, const
             fprintf (stderr, "   Vote for X:=A" );
             eval ( rnd == 0 );
             rnd   = random_number ();
-            if ( state == 6  &&  state == 7 )
+            if ( state == 6  ||  state == 7 )
                 state = 6 + rnd;
             else if ( state != rnd )
                 state = rnd + 2;
@@ -756,7 +756,7 @@ void testing ( const stereo_t* A, const
             fprintf (stderr, "   Vote for X:=B" );
             eval ( rnd == 1 );
             rnd   = random_number ();
-            if ( state == 6  &&  state == 7 )
+            if ( state == 6  ||  state == 7 )
                 state = 6 + rnd;
             else if ( state != rnd )
                 state = rnd + 2;

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Lame-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/lame-dev