New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] Coverity: regcomp.c: bit-or used when bit-and meant #13770
Comments
From @jhiregcomp.c:14693-ish: operator_confusion: ret->flags | 0x10 is always 1/true regardless of - && ! ((ANYOF_FLAGS(ret) | ANYOF_WARN_SUPER) && ALWAYS_WARN_SUPER)) (confirmed by Karl Williamson) Attached. |
From @jhi0001-Fix-for-Coverity-perl5-CID-28936.patchFrom e57c6ffa8fb795aa1ac77f67ee99dbe96df8b5aa Mon Sep 17 00:00:00 2001
From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Fri, 25 Apr 2014 08:25:52 -0400
Subject: [PATCH] Fix for Coverity perl5 CID 28936: Wrong operator used
(CONSTANT_EXPRESSION_RESULT)
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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/regcomp.c b/regcomp.c
index ca2ffb8..b18022a 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -14690,7 +14690,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 */
--
1.9.2
|
From @tonycozOn Sat Apr 26 09:41:48 2014, jhi wrote:
This appears (to me) to be a lost optimization opportunity rather than a critical bug. Added as a 5.21.1 blocker so it will be applied after 5.20 is released. Tony |
The RT System itself - Status changed from 'new' to 'open' |
From @khwilliamsonOn 04/27/2014 05:43 PM, Tony Cook via RT wrote:
Correct
|
@tsee - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#121738 (status was 'resolved')
Searchable as RT121738$
The text was updated successfully, but these errors were encountered: