Hi Andrew,

This patch adds check for POINTER_TYPE_P before accessing SSA_NAME_PTR_INFO
in remap_ssa_name in gcc/tree-inline.c. This is not related to IPA_VRP but
was exposed by that.

SSA_NAME_PTR_INFO should be NULL for non POINTER_TYPE ssa names?  Why
is it not null in your case?
In both cases there is a check for SSA_NAME_PTR_INFO being NULL before using it.

As per tree.h:

#define SSA_NAME_PTR_INFO(N) \
   SSA_NAME_CHECK (N)->ssa_name.info.ptr_info

#define SSA_NAME_RANGE_INFO(N) \
    SSA_NAME_CHECK (N)->ssa_name.info.range_info

ptr_info and range_info are unions (see below). Unless I am missing something, now that we set range_info, we should check it is POINTER_TYPE_P before accessing.

  /* Value range information.  */
  union ssa_name_info_type {
    /* Pointer attributes used for alias analysis.  */
    struct GTY ((tag ("0"))) ptr_info_def *ptr_info;
    /* Value range attributes used for zero/sign extension elimination.  */
    struct GTY ((tag ("1"))) range_info_def *range_info;
  } GTY ((desc ("%1.typed.type ?" \
                "!POINTER_TYPE_P (TREE_TYPE ((tree)&%1)) : 2"))) info;


Thanks,
Kugan

Reply via email to