From 26122e2d8a1aa5e8ea91f7df94513cde1e2de509 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 30 Aug 2016 08:45:56 +0200 Subject: [PATCH] re PR middle-end/77377 (c-c++-common/pr59037.c ICEs with -fpic -msse on i686) PR middle-end/77377 * simplify-rtx.c (avoid_constant_pool_reference): For out of bounds constant pool reference return x instead of c. * gcc.target/i386/pr77377.c: New test. From-SVN: r239854 --- gcc/ChangeLog | 6 ++++++ gcc/simplify-rtx.c | 7 +++---- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.target/i386/pr77377.c | 6 ++++++ 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr77377.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b7117b49295..347c7c6a50d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-08-30 Jakub Jelinek + + PR middle-end/77377 + * simplify-rtx.c (avoid_constant_pool_reference): For out of bounds + constant pool reference return x instead of c. + 2016-08-29 Segher Boessenkool * config/rs6000/rs6000.h (CALL_REALLY_USED_REGISTERS): Do not diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 2085b997416..8daef97b473 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -251,15 +251,14 @@ avoid_constant_pool_reference (rtx x) /* If we're accessing the constant in a different mode than it was originally stored, attempt to fix that up via subreg simplifications. If that fails we have no choice but to return the original memory. */ - if ((offset != 0 || cmode != GET_MODE (x)) - && offset >= 0 && offset < GET_MODE_SIZE (cmode)) + if (offset == 0 && cmode == GET_MODE (x)) + return c; + else if (offset >= 0 && offset < GET_MODE_SIZE (cmode)) { rtx tem = simplify_subreg (GET_MODE (x), c, cmode, offset); if (tem && CONSTANT_P (tem)) return tem; } - else - return c; } return x; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c62855c522d..7a435819a68 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-08-30 Jakub Jelinek + PR middle-end/77377 + * gcc.target/i386/pr77377.c: New test. + PR debug/77389 * g++.dg/debug/dwarf2/template-params-12f.C: Pass -gno-strict-dwarf in dg-options. diff --git a/gcc/testsuite/gcc.target/i386/pr77377.c b/gcc/testsuite/gcc.target/i386/pr77377.c new file mode 100644 index 00000000000..4f7eaa4981b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr77377.c @@ -0,0 +1,6 @@ +/* PR middle-end/77377 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -msse" } */ +/* { dg-additional-options "-fpic" { target fpic } } */ + +#include "../../c-c++-common/pr59037.c" -- 2.30.2