Copying array-typed field of structured array

Edit: Numba 0.53.1 on windows python 3.7.1

I’m trying to copy a member of a numpy structured array element, like below. It works as expected in plain-python mode, and it works as expected in njit mode if the array assignment is commented.

Any tips on how to get the ‘array’ member to copy correctly?

import numpy as np
from numba import njit

src_dtype = np.dtype([
    ("user", np.float64),
    ("array", np.int16, (3,))
], align=True)


dest_dtype = np.dtype([
    ("user1", np.float64),
    ("array1", np.int16, (3,))
], align=True)


# @njit # uncomment this to see the error
def copy(index, src, dest):
    dest['user1'] = src[index]['user']
    dest['array1'] = src[index]['array']

source = np.empty(5, dtype=src_dtype)
dest = np.empty(5, dtype=dest_dtype)

source[0] = (1.2, [1, 2, 3])
copy(0, source, dest[0])
print(dest[0])

numba.core.errors.LoweringError: Failed in nopython mode pipeline (step: nopython mode backend)
Can only insert i16 at [0] in [3 x i16]: got i8*

File “discourse.py”, line 20:
def copy(index, src, dest):

dest[‘user1’] = src[index][‘user’]
dest[‘array1’] = src[index][‘array’]
^

During: lowering “dest[‘array1’] = $26binary_subscr.11” at A:/work/git/mims/playground/erik/discourse.py (20)

I tested with 0.55.0rc1 at @Hannes’ suggestion, the program ran but produced erroneous results.

Bug report filed here