[Swift error] process exited with signal SIGILL

I tried to use swift to solve an algorithm problem, but it gave me an error

Problem Link: https://leetcode.com/problems/number-of-matching-subsequences/

class Solution {
   func bisect_right(arr: [Int], num: Int) -> Int {
       var l = 0, r = arr.count - 1
       while l < r {
           var m = (l+r) / 2
           if arr[m] <= num {
               l = m + 1
           } else {
               r = m
           }
       }
       return l
   }

   func numMatchingSubseq(_ s: String, _ words: [String]) -> Int {
       var pos: [Character: [Int]] = [:]
       for (i, c) in s.enumerated() {
           pos[c]!.append(i)
       }
       var cnt = 0
       for word in words {
           var prev = -1, ok = true
           for c in word {
               let ps = pos[c]!
               var res = bisect_right(arr: ps, num: prev)
               if res == ps.count {
                   ok = false; break
               }
               prev = ps[res]
           }
           if ok {
               cnt += 1
           }
       }
       return cnt
   }
}

i.e. s= "abcde" words = ["a","bb","acd","ace"]

It usually happens when the CPU does not properly get the instructions or simply can not execute. I had a similar encounter while solving the "Super Pow" challenge on Leetcode. The underlying CPU that Leetcode provided could calculate the pow() in my code up to a specific range and the same algorithm failed when the power was raised to 200 or more on a large Int base. So, this issue is mainly due to lack of computation power of a CPU while performing large computations as I can observe.

[Swift error] process exited with signal SIGILL
 
 
Q