From: Bill Schmidt Date: Sun, 11 Dec 2016 23:37:17 +0000 (+0000) Subject: re PR target/78695 (ICE (segfault) on powerpc64le-linux-gnu) X-Git-Tag: basepoints/gcc-8~2392 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3113e92dc3dc525af2b1b1d159ea5fed1828bd3b;p=thirdparty%2Fgcc.git re PR target/78695 (ICE (segfault) on powerpc64le-linux-gnu) [gcc] 2016-12-11 Bill Schmidt PR target/78695 * config/rs6000/rs6000.c (find_alignment_op): Discard from consideration any artificial definition. [gcc/testsuite] 2016-12-11 Bill Schmidt PR target/78695 * gcc.target/powerpc/swaps-stack-protector.c: New test. From-SVN: r243534 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9a48b0c02e6..b6a058bf4494 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-12-11 Bill Schmidt + + PR target/78695 + * config/rs6000/rs6000.c (find_alignment_op): Discard from + consideration any artificial definition. + 2016-12-11 Iain Sandoe * configure.ac (CROSS directory tests): Remove the assumption that diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 55e9548f7669..6aa843697550 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -41433,6 +41433,12 @@ find_alignment_op (rtx_insn *insn, rtx base_reg) if (!base_def_link || base_def_link->next) break; + /* With stack-protector code enabled, and possibly in other + circumstances, there may not be an associated insn for + the def. */ + if (DF_REF_IS_ARTIFICIAL (base_def_link->ref)) + break; + rtx_insn *and_insn = DF_REF_INSN (base_def_link->ref); and_operation = alignment_mask (and_insn); if (and_operation != 0) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aa9aae76e13f..cde6eefc8eeb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-11 Bill Schmidt + + PR target/78695 + * gcc.target/powerpc/swaps-stack-protector.c: New test. + 2016-12-11 Uros Bizjak PR target/70799 diff --git a/gcc/testsuite/gcc.target/powerpc/swaps-stack-protector.c b/gcc/testsuite/gcc.target/powerpc/swaps-stack-protector.c new file mode 100644 index 000000000000..8093a26cc564 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/swaps-stack-protector.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-fstack-protector -O3" } */ + +/* PR78695: This code used to ICE in rs6000.c:find_alignment_op because + the stack protector address definition isn't associated with an insn. */ + +void *a(); +long b() { + char c[1]; + char *d = a(), *e = c; + long f = e ? b(e) : 0; + if (f > 54) + f = 1; + while (f--) + *d++ = *e++; +}