From 50ffe7adc0d686e9f193c4e53ea2f0d617309f35 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 17 Apr 2018 11:16:48 +0200 Subject: [PATCH] re PR middle-end/85414 (ICE: in ix86_expand_prologue, at config/i386/i386.c:13810 with -Og -fgcse) PR middle-end/85414 * rtlhooks.c (gen_lowpart_if_possible): Don't call gen_lowpart_SUBREG on a SUBREG. * gcc.dg/pr85414.c: New test. From-SVN: r259433 --- gcc/ChangeLog | 6 ++++++ gcc/rtlhooks.c | 4 ++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr85414.c | 10 ++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr85414.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 21966a39d8e..e444bf1c7c1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-04-17 Jakub Jelinek + + PR middle-end/85414 + * rtlhooks.c (gen_lowpart_if_possible): Don't call gen_lowpart_SUBREG + on a SUBREG. + 2018-04-17 Martin Jambor PR ipa/85421 diff --git a/gcc/rtlhooks.c b/gcc/rtlhooks.c index ecdebbbeb81..59145506a25 100644 --- a/gcc/rtlhooks.c +++ b/gcc/rtlhooks.c @@ -123,9 +123,9 @@ gen_lowpart_if_possible (machine_mode mode, rtx x) return new_rtx; } - else if (mode != GET_MODE (x) && GET_MODE (x) != VOIDmode + else if (mode != GET_MODE (x) && GET_MODE (x) != VOIDmode && !SUBREG_P (x) && validate_subreg (mode, GET_MODE (x), x, - subreg_lowpart_offset (mode, GET_MODE (x)))) + subreg_lowpart_offset (mode, GET_MODE (x)))) return gen_lowpart_SUBREG (mode, x); else return 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9e44409cb7a..95bdc0349b4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-17 Jakub Jelinek + + PR middle-end/85414 + * gcc.dg/pr85414.c: New test. + 2018-04-17 Martin Jambor PR ipa/85421 diff --git a/gcc/testsuite/gcc.dg/pr85414.c b/gcc/testsuite/gcc.dg/pr85414.c new file mode 100644 index 00000000000..d0613249242 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr85414.c @@ -0,0 +1,10 @@ +/* PR middle-end/85414 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-Og -fgcse -Wno-uninitialized" } */ + +int +foo (void) +{ + unsigned __int128 c; + return __builtin_mul_overflow_p (59, -c, (short) 0); +} -- 2.30.2