]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR rtl-optimization/89234 (ICE in get_eh_region_and_lp_from_rtx at gcc...
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Aug 2019 11:46:29 +0000 (13:46 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Aug 2019 11:46:29 +0000 (13:46 +0200)
Backported from mainline
2019-02-08  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/89234
* except.c (copy_reg_eh_region_note_forward): Return if note_or_insn
is a NOTE, CODE_LABEL etc. - rtx_insn * other than INSN_P.
(copy_reg_eh_region_note_backward): Likewise.

* g++.dg/ubsan/pr89234.C: New test.

From-SVN: r275105

gcc/ChangeLog
gcc/except.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ubsan/pr89234.C [new file with mode: 0644]

index 4f5bbd3b542e3f201a44fdef27727644cde3984b..993796fb04a2b32e8c349f94867a6dd32638ecb8 100644 (file)
@@ -1,6 +1,13 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-02-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/89234
+       * except.c (copy_reg_eh_region_note_forward): Return if note_or_insn
+       is a NOTE, CODE_LABEL etc. - rtx_insn * other than INSN_P.
+       (copy_reg_eh_region_note_backward): Likewise.
+
        2019-02-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/89188
index a22413d43b379960763a83aacdac407d418b19e2..3d0ea2d9c282eb8a07ade21f4fa90aff71097066 100644 (file)
@@ -1728,6 +1728,8 @@ copy_reg_eh_region_note_forward (rtx note_or_insn, rtx_insn *first, rtx last)
       if (note == NULL)
        return;
     }
+  else if (is_a <rtx_insn *> (note_or_insn))
+    return;
   note = XEXP (note, 0);
 
   for (insn = first; insn != last ; insn = NEXT_INSN (insn))
@@ -1750,6 +1752,8 @@ copy_reg_eh_region_note_backward (rtx note_or_insn, rtx_insn *last, rtx first)
       if (note == NULL)
        return;
     }
+  else if (is_a <rtx_insn *> (note_or_insn))
+    return;
   note = XEXP (note, 0);
 
   for (insn = last; insn != first; insn = PREV_INSN (insn))
index d4f48a63c319ac6df7bb758ea96feb63c2006386..c416a1d4382c217bf867e496b8194360f9e616ad 100644 (file)
@@ -1,6 +1,11 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-02-08  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/89234
+       * g++.dg/ubsan/pr89234.C: New test.
+
        2019-02-05  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/89187
diff --git a/gcc/testsuite/g++.dg/ubsan/pr89234.C b/gcc/testsuite/g++.dg/ubsan/pr89234.C
new file mode 100644 (file)
index 0000000..af1526c
--- /dev/null
@@ -0,0 +1,11 @@
+// PR rtl-optimization/89234
+// { dg-do compile { target dfp } }
+// { dg-options "-O2 -fnon-call-exceptions -fsanitize=null" }
+
+typedef float __attribute__((mode (SD))) _Decimal32;
+
+void
+foo (_Decimal32 *b, _Decimal32 c)
+{
+  *b = c + 1.5;
+}