This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix for Coverity perl5 CID 28936: Wrong operator used (CONSTANT_EXPRESSION_RESULT)
authorJarkko Hietaniemi <jhi@iki.fi>
Fri, 25 Apr 2014 12:25:52 +0000 (08:25 -0400)
committerSteffen Mueller <smueller@cpan.org>
Wed, 28 May 2014 17:27:21 +0000 (19:27 +0200)
operator_confusion: ret->flags | 0x10 is always 1/true regardless of
the values of its operand. This occurs as the logical first operand of '&&'.
Did you intend to use '&' rather than '|'?

(confirmed by Karl Williamson)

regcomp.c

index b18149f..d2f95c2 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -14718,7 +14718,7 @@ parseit:
            /* We don't optimize if we are supposed to make sure all non-Unicode
             * code points raise a warning, as only ANYOF nodes have this check.
             * */
-        && ! ((ANYOF_FLAGS(ret) | ANYOF_WARN_SUPER) && ALWAYS_WARN_SUPER))
+        && ! ((ANYOF_FLAGS(ret) & ANYOF_WARN_SUPER) && ALWAYS_WARN_SUPER))
     {
         UV start, end;
         U8 op = END;  /* The optimzation node-type */