Message ID | fb778284-b26d-9e2a-b7b6-dc5f4189410e@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
Hi Bill, On Sun, Dec 11, 2016 at 01:35:59PM -0600, Bill Schmidt wrote: > --- gcc/config/rs6000/rs6000.c (revision 243506) > +++ gcc/config/rs6000/rs6000.c (working copy) > @@ -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 (!base_def_link->ref->base.insn_info) > + break; Maybe this should use DF_REF_IS_ARTIFICIAL? Or if that doesn't work, DF_REF_INSN_INFO? Segher
Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 243506) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -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 (!base_def_link->ref->base.insn_info) + break; + rtx_insn *and_insn = DF_REF_INSN (base_def_link->ref); and_operation = alignment_mask (and_insn); if (and_operation != 0) Index: gcc/testsuite/gcc.target/powerpc/swaps-stack-protector.c =================================================================== --- gcc/testsuite/gcc.target/powerpc/swaps-stack-protector.c (revision 0) +++ gcc/testsuite/gcc.target/powerpc/swaps-stack-protector.c (working copy) @@ -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++; +}