Fix incorrect compiling when variable-length lookbehind's first branch was not the shortest and there was a backreference to a groupwithin the lookbehind.

Cherry-picked from 4a6a8b056f39079d5e958eac84c2ad173f4680bc.
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index 8b36497..71c2dbc 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -9908,7 +9908,7 @@
   *bptr |= branchlength;  /* branchlength never more than 65535 */
   bptr = *pptrptr;
   }
-while (*bptr == META_ALT);
+while (META_CODE(*bptr) == META_ALT);
 
 /* If any branch is of variable length, the whole lookbehind is of variable
 length. If the maximum length of any branch exceeds the maximum for variable
diff --git a/testdata/testinput2 b/testdata/testinput2
index 9760854..9b4c068 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -6099,4 +6099,8 @@
 /(a(?1)z||(?1)++)$/
     abcd\=disable_recurseloop_check
 
+/(((?<=123?456456|ABC)))(?<=\2)../
+    ABCDEFG
+    12345645678910 
+
 # End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index ee1f70b..30c5a83 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -18038,6 +18038,16 @@
  0: 
  1: 
 
+/(((?<=123?456456|ABC)))(?<=\2)../
+    ABCDEFG
+ 0: DE
+ 1: 
+ 2: 
+    12345645678910 
+ 0: 78
+ 1: 
+ 2: 
+
 # End of testinput2
 Error -70: PCRE2_ERROR_BADDATA (unknown error number)
 Error -62: bad serialized data