From: Uros Bizjak Date: Mon, 30 Oct 2017 10:33:40 +0000 (+0100) Subject: re PR target/82725 ([x86_64] internal compiler error: in change_address_1, at emit... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5603c1d9db454cd1f2182f5de3a32c9d1c32497e;p=gcc.git re PR target/82725 ([x86_64] internal compiler error: in change_address_1, at emit-rtl.c:2162) PR target/82725 * config/i386/i386.c (legitimate_pic_address_disp_p): Allow UNSPEC_DTPOFF and UNSPEC_NTPOFF with SImode immediate offset. testsuite/ChangeLog: PR target/82725 * g++.dg/pr82725.C: New test. From-SVN: r254212 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 72e8e2b317f..ffbc1fb06c2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-10-30 Uros Bizjak + + PR target/82725 + * config/i386/i386.c (legitimate_pic_address_disp_p): Allow + UNSPEC_DTPOFF and UNSPEC_NTPOFF with SImode immediate offset. + 2017-10-29 Jim Wilson * gimplify.c: Include tm_p.h. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index a66b433d78d..2de0dd0c283 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -15079,10 +15079,16 @@ legitimate_pic_address_disp_p (rtx disp) break; op0 = XEXP (XEXP (disp, 0), 0); op1 = XEXP (XEXP (disp, 0), 1); - if (!CONST_INT_P (op1) - || INTVAL (op1) >= 16*1024*1024 + if (!CONST_INT_P (op1)) + break; + if (GET_CODE (op0) == UNSPEC + && (XINT (op0, 1) == UNSPEC_DTPOFF + || XINT (op0, 1) == UNSPEC_NTPOFF) + && trunc_int_for_mode (INTVAL (op1), SImode) == INTVAL (op1)) + return true; + if (INTVAL (op1) >= 16*1024*1024 || INTVAL (op1) < -16*1024*1024) - break; + break; if (GET_CODE (op0) == LABEL_REF) return true; if (GET_CODE (op0) == CONST diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cd3e7f5b01b..97338fdacd0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,8 +1,12 @@ +2017-10-30 Uros Bizjak + + PR target/82725 + * g++.dg/pr82725.C: New test. + 2017-10-29 Jim Wilson * lib/gcc-dg.exp (gcc-dg-debug-runtest): Delete -gcoff. - * lib/gfortran-dg.exp (gfortran-dg-debug-runtest): Delete - -gcoff. + * lib/gfortran-dg.exp (gfortran-dg-debug-runtest): Delete -gcoff. 2017-10-28 Paolo Carlini diff --git a/gcc/testsuite/g++.dg/pr82725.C b/gcc/testsuite/g++.dg/pr82725.C new file mode 100644 index 00000000000..c92b28a3520 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr82725.C @@ -0,0 +1,16 @@ +// { dg-do compile { target i?86-*-* x86_64-*-* } } +// { dg-require-effective-target pie } +// { dg-options "-O2 -fpie -mtls-direct-seg-refs" } + +struct string +{ + __SIZE_TYPE__ length; + const char *ptr; +}; + +string +tempDir () +{ + thread_local string cache; + return cache; +}