This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/79558] [5/6/7 Regression] ICE: Segfault in ubsan_type_descriptor, at ubsan.c:412


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79558

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I think the fix is just:

--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -409,7 +409,9 @@ ubsan_type_descriptor (tree type, enum ubsan_print_style
pstyle)
    {
      pp_left_bracket (&pretty_name);
      tree dom = TYPE_DOMAIN (t);
-     if (dom && TREE_CODE (TYPE_MAX_VALUE (dom)) == INTEGER_CST)
+     if (dom != NULL_TREE
+         && TYPE_MAX_VALUE (dom) != NULL_TREE
+         && TREE_CODE (TYPE_MAX_VALUE (dom)) == INTEGER_CST)
        {
          if (tree_fits_uhwi_p (TYPE_MAX_VALUE (dom))
          && tree_to_uhwi (TYPE_MAX_VALUE (dom)) + 1 != 0)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]