From: Jakub Jelinek Date: Fri, 30 Aug 2019 11:46:29 +0000 (+0200) Subject: backport: re PR rtl-optimization/89234 (ICE in get_eh_region_and_lp_from_rtx at gcc... X-Git-Tag: releases/gcc-7.5.0~258 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=046d004057e3090eb217624efc14a05f62853a72;p=thirdparty%2Fgcc.git backport: re PR rtl-optimization/89234 (ICE in get_eh_region_and_lp_from_rtx at gcc/except.c:1824) Backported from mainline 2019-02-08 Jakub Jelinek 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f5bbd3b542e..993796fb04a2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,13 @@ 2019-08-30 Jakub Jelinek Backported from mainline + 2019-02-08 Jakub Jelinek + + 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 PR target/89188 diff --git a/gcc/except.c b/gcc/except.c index a22413d43b37..3d0ea2d9c282 100644 --- a/gcc/except.c +++ b/gcc/except.c @@ -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 (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 (note_or_insn)) + return; note = XEXP (note, 0); for (insn = last; insn != first; insn = PREV_INSN (insn)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d4f48a63c319..c416a1d4382c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2019-08-30 Jakub Jelinek Backported from mainline + 2019-02-08 Jakub Jelinek + + PR rtl-optimization/89234 + * g++.dg/ubsan/pr89234.C: New test. + 2019-02-05 Jakub Jelinek 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 index 000000000000..af1526c03915 --- /dev/null +++ b/gcc/testsuite/g++.dg/ubsan/pr89234.C @@ -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; +}