add workaround for dlopen() bug on OpenBSD (relative paths that
[p5sagit/p5-mst-13.2.git] / regexec.c
index adde1dd..0bd9da8 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -639,7 +639,10 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
        /* Even in this situation we may use MBOL flag if strpos is offset
           wrt the start of the string. */
        if (ml_anch && sv
-           && (strpos + SvCUR(sv) != strend) && strpos[-1] != '\n') {
+           && (strpos + SvCUR(sv) != strend) && strpos[-1] != '\n'
+           /* May be due to an implicit anchor of m{.*foo}  */
+           && !(prog->reganch & ROPT_IMPLICIT))
+       {
            t = strpos;
            goto find_anchor;
        }
@@ -730,13 +733,17 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos,
                          (long)(other_last - i_strpos)) );
                goto do_other_anchored;
            }
-           if (!prog->float_substr) {  /* Could have been deleted */
-               if (ml_anch) {
-                   s = t = t + 1;
-                   goto try_at_offset;
-               }
-               goto fail;
+           /* Another way we could have checked stclass at the
+               current position only: */
+           if (ml_anch) {
+               s = t = t + 1;
+               DEBUG_r( PerlIO_printf(Perl_debug_log,
+                         "Trying /^/m starting at offset %ld...\n",
+                         (long)(t - i_strpos)) );
+               goto try_at_offset;
            }
+           if (!prog->float_substr)    /* Could have been deleted */
+               goto fail;
            /* Check is floating subtring. */
          retry_floating_check:
            t = check_at - start_shift;