# Buggy code
def __init__(self, py_func, sigs, targetoptions):
    self.py_func = py_func
    self.sigs = []
    self.link = targetoptions.pop(
        "link",
        (),
    )
    self._can_compile = True

    # Specializations for given sets of argument types
    self.specializations = {}

    # A mapping of signatures to compile results
    self.overloads = collections.OrderedDict()

    self.targetoptions = targetoptions

    # defensive copy
    self.targetoptions["extensions"] = list(self.targetoptions.get("extensions", []))

    from .descriptor import CUDATargetDesc

    self.typingctx = CUDATargetDesc.typingctx

    self._tm = default_type_manager

    pysig = utils.pysignature(py_func)
    arg_count = len(pysig.parameters)
    argnames = tuple(pysig.parameters)
    default_values = self.py_func.__defaults__ or ()
    defargs = tuple(OmittedArg(val) for val in default_values)
    can_fallback = False  # CUDA cannot fallback to object mode

    try:
        lastarg = list(pysig.parameters.values())[-1]
    except IndexError:
        has_stararg = False
    else:
        has_stararg = lastarg.kind == lastarg.VAR_POSITIONAL

    exact_match_required = False

    _dispatcher.Dispatcher.__init__(
        self,
        self._tm.get_pointer(),
        arg_count,
        self._fold_args,
        argnames,
        defargs,
        can_fallback,
        has_stararg,
        exact_match_required,
    )

    if sigs:
        if len(sigs) > 1:
            raise TypeError("Only one signature supported at present")
        self.compile(sigs[0])
        self._can_compile = False


# Traceback (numba.cuda.cudadrv.error.NvvmError)
Traceback (most recent call last):
File "repro.py", line 6, in <module>
cuda.compile_ptx_for_current_device(f, [], device=True, debug=True)
File "/home/gmarkall/numbadev/numba/numba/cuda/compiler.py", line 124, in compile_ptx_for_current_device
return compile_ptx(pyfunc, args, debug=-debug, device=device,
File "/home/gmarkall/numbadev/numba/numba/core/compiler_lock.py", line 35, in _acquire_compile_lock
return func(*args, **kwargs)
File "/home/gmarkall/numbadev/numba/numba/cuda/compiler.py", line 114, in compile_ptx
ptx = nvvm.llvm_to_ptx(llvmir, opt=opt, arch=arch, **options)
File "/home/gmarkall/numbadev/numba/numba/cuda/cudadrv/nvvm.py", line 669, in llvm_to_ptx
ptx = cu.compile(**opts)
File "/home/gmarkall/numbadev/numba/numba/cuda/cudadrv/nvvm.py", line 265, in compile
self._try_error(err, 'Failed to compile\n')
File "/home/gmarkall/numbadev/numba/numba/cuda/cudadrv/nvvm.py", line 283, in _try_error
self.driver.check_error(err, "%s\n%s" % (msg, self.get_log()))
File "/home/gmarkall/numbadev/numba/numba/cuda/cudadrv/nvvm.py", line 173, in check_error
raise exc
numba.cuda.cudadrv.error.NvvmError: Failed to compile

DBG version 1.0 incompatible with current version 3.0
<unnamed>: error: incompatible IR detected. Possible mix of compiler/IR from different releases.
NVVM_ERROR_IR_VERSION_MISMATCH

# Fixed code
def __init__(self, py_func, sigs, targetoptions):
    self.py_func = py_func
    self.sigs = []
    self.link = targetoptions.pop(
        "link",
        (),
    )
    self._can_compile = True

    # Specializations for given sets of argument types
    self.specializations = {}

    # A mapping of signatures to compile results
    self.overloads = collections.OrderedDict()

    self.targetoptions = targetoptions

    # defensive copy
    self.targetoptions["extensions"] = list(self.targetoptions.get("extensions", []))

    from .descriptor import cuda_target

    self.typingctx = cuda_target.typingctx

    self._tm = default_type_manager

    pysig = utils.pysignature(py_func)
    arg_count = len(pysig.parameters)
    argnames = tuple(pysig.parameters)
    default_values = self.py_func.__defaults__ or ()
    defargs = tuple(OmittedArg(val) for val in default_values)
    can_fallback = False  # CUDA cannot fallback to object mode

    try:
        lastarg = list(pysig.parameters.values())[-1]
    except IndexError:
        has_stararg = False
    else:
        has_stararg = lastarg.kind == lastarg.VAR_POSITIONAL

    exact_match_required = False

    _dispatcher.Dispatcher.__init__(
        self,
        self._tm.get_pointer(),
        arg_count,
        self._fold_args,
        argnames,
        defargs,
        can_fallback,
        has_stararg,
        exact_match_required,
    )

    if sigs:
        if len(sigs) > 1:
            raise TypeError("Only one signature supported at present")
        self.compile(sigs[0])
        self._can_compile = False