o
    8ήcd                     @   s   d Z ddlZddlmZ ddlmZ ddlmZm	Z	m
Z
mZ ddlmZ G dd de
ZG d	d
 d
e	Zeed< eeed < G dd deZe Zedd Zdd Zedkr\e  dS dS )a  
This is a test for an error with ir_utils._max_label not being updated
correctly. As a result of the error, inline_closurecall will incorrectly
overwrite an existing label, resulting in code that creates an effect-free
infinite loop, which is an undefined behavior to LLVM. LLVM will then assume
the function can never execute and an alternative code path will be taken
in spite of the value of any conditional branch that is guarding the alternative
code path.
    N)njit)TargetConfigurationStack)dispatcher_registryCPUDispatcherCPUtarget_registry)BasicRetargetc                   @      e Zd ZdS )	CustomCPUN__name__
__module____qualname__ r   r   J/tmp/pip-target-vg8gfxp4/lib/python/numba/tests/parfors_max_label_error.pyr
          r
   c                   @   r	   )CustomCPUDispatcherNr   r   r   r   r   r      r   r   c                   @   s    e Zd Zedd Zdd ZdS )MyCustomTargetc                 C   s   dS )Nr
   r   )selfr   r   r   output_target)   s   zMyCustomTarget.output_targetc                 C   s   t ddd|j}|S )Nr
   T)_targetparallel)r   py_func)r   cpu_dispkernelr   r   r   compile_retarget-   s   zMyCustomTarget.compile_retargetN)r   r   r   propertyr   r   r   r   r   r   r   (   s    
r   c                 C   s   t | jS )N)nparangesize)ar   r   r   f6   s   r!   c                  C   s\   t d} tt t| }W d    n1 sw   Y  t j|t|  t	d d S )N   zTEST PASSED)
r   onesr   switch_targetretargetr!   testingassert_equalr   print)r    rr   r   r   main;   s   

r*   __main__)__doc__numpyr   numbar   numba.core.dispatcherr   numba.core.target_extensionr   r   r   r   numba.core.retargetr   r
   r   r   r%   r!   r*   r   r   r   r   r   <module>   s$    	


