Compiler crash when writing to `ptr UncheckedArray` casted from `pointer` in JS backend
### Description

The following code crashes the compiler when generating code for the Javascript backend. It does not crash when using the C backend, however.
```nim
proc uchrr(outp, inp: pointer) =
  var i = cast[ptr UncheckedArray[byte]](inp)
  var o = cast[ptr UncheckedArray[byte]](outp)
  o[0] = i[0]  # <-- compiler crashes here

let n = 0xdeadbeef
var no: int32
uchrr(no.addr(), n.addr())
assert no == 0xef
```

### Nim Version

Nim Compiler Version 2.1.99 [Linux: amd64]
Compiled at 2024-09-16
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 651fdbe586bcee64bd7f4b96c2b98b5970d0eb62

### Current Output

```text
/home/user/Nim/buge.nim(4, 4) Error: internal error: expr(nkBracketExpr, tyUncheckedArray)
Traceback (most recent call last)
/home/user/Nim/compiler/nim.nim(169) nim
/home/user/Nim/compiler/nim.nim(124) handleCmdLine
/home/user/Nim/compiler/main.nim(307) mainCommand
/home/user/Nim/compiler/main.nim(277) compileToBackend
/home/user/Nim/compiler/main.nim(171) commandCompileToJS
/home/user/Nim/compiler/pipelines.nim(312) compilePipelineProject
/home/user/Nim/compiler/pipelines.nim(232) compilePipelineModule
/home/user/Nim/compiler/pipelines.nim(179) processPipelineModule
/home/user/Nim/compiler/pipelines.nim(28) processPipeline
/home/user/Nim/compiler/jsgen.nim(3155) processJSCodeGen
/home/user/Nim/compiler/jsgen.nim(3140) genModule
/home/user/Nim/compiler/jsgen.nim(2829) genStmt
/home/user/Nim/compiler/jsgen.nim(3027) gen
/home/user/Nim/compiler/jsgen.nim(2829) genStmt
/home/user/Nim/compiler/jsgen.nim(2974) gen
/home/user/Nim/compiler/jsgen.nim(1871) genCall
/home/user/Nim/compiler/jsgen.nim(2900) gen
/home/user/Nim/compiler/jsgen.nim(1697) genSym
/home/user/Nim/compiler/jsgen.nim(1631) genProcForSymIfNeeded
/home/user/Nim/compiler/jsgen.nim attachProc
/home/user/Nim/compiler/jsgen.nim(2780) genProc
/home/user/Nim/compiler/jsgen.nim(2829) genStmt
/home/user/Nim/compiler/jsgen.nim(3027) gen
/home/user/Nim/compiler/jsgen.nim(2829) genStmt
/home/user/Nim/compiler/jsgen.nim(3043) gen
/home/user/Nim/compiler/jsgen.nim(1342) genAsgn
/home/user/Nim/compiler/jsgen.nim(1284) genAsgnAux
/home/user/Nim/compiler/jsgen.nim(3002) gen
/home/user/Nim/compiler/jsgen.nim(1491) genArrayAccess
/home/user/Nim/compiler/msgs.nim(634) internalErrorImpl
/home/user/Nim/compiler/msgs.nim(589) liMessage
/home/user/Nim/compiler/msgs.nim(433) handleError
/home/user/Nim/compiler/msgs.nim(421) quit
```


### Expected Output

```text
Successful compilation and program termination.
```


### Known Workarounds

_No response_

### Additional Information

Same behavior in stable 2.0.8 release.