On 12/6/18 3:16 AM, Tony Cook wrote: > On Wed, Dec 05, 2018 at 10:28:54PM -0500, James E Keenan wrote: >> Here is a case where the LGTM.com analysis of the Perl 5 source code >> produces results that are at first plausible but ultimately incorrect. >> >> The following section of regexec.c is cited (https://lgtm.com/projects/g/Perl/perl5/alerts/?mode=tree&ruleFocus=2154840804) >> with the warning-level alert "Comparison result is always the same": > > This was discussed in #133686, the comparison needs to stay to allow > for local configuration of larger values of NUM_ANYOF_CODE_POINTS. > >> I then created a branch (jkeenan/lgtm-regexec-c; https://perl5.git.perl.org/perl.git/commitdiff/1a6c6e69bfa70bc55eb0d1e85538d7420659a652) >> in which I simply removed those two comparisons. Notwithstanding the >> alleged superfluousness of the two comparisons, I got these failures: >> >> ##### >> Test Summary Report >> ------------------- >> re/regexp_noamp.t (Wstat: 0 >> Tests: 2006 Failed: 4) >> Failed tests: 1830-1831, 1838-1839 >> re/regexp.t (Wstat: 0 >> Tests: 2006 Failed: 4) >> Failed tests: 1830-1831, 1838-1839 > > The tests are failing because of the added > _CHECK_AND_OUTPUT_WIDE_LOCALE_CP_MSG(c);, from your commit: > > diff --git a/regexec.c b/regexec.c > index eb24567e04..a265cc84cb 100644 > --- a/regexec.c > +++ b/regexec.c > @@ -9772,15 +9772,13 @@ S_reginclass(pTHX_ regexp * const prog, const regnode * const n, const U8* const > match = TRUE; > } > else if (flags & ANYOF_LOCALE_FLAGS) { > + _CHECK_AND_OUTPUT_WIDE_LOCALE_CP_MSG(c); > if ((flags & ANYOFL_FOLD) > - && c < 256 > && ANYOF_BITMAP_TEST(n, PL_fold_locale[c])) > { > match = TRUE; > > > Remove that and they pass. > You are correct, as I now see in this newer branch: jkeenan/2nd-lgtm-regexec-c. I don't know how that line got into my original branch. Sorry for the confusion. Thank you very much. Jim KeenanThread Previous | Thread Next