i386: Skip DF_REF_INSN if DF_REF_INSN_INFO is false

We should check DF_REF_INSN_INFO before accessing DF_REF_INSN.

gcc/

	PR target/82673
	* config/i386/i386.c (ix86_finalize_stack_frame_flags): Skip
	DF_REF_INSN if DF_REF_INSN_INFO is false.

gcc/testsuite/

	PR target/82673
	* gcc.target/i386/pr82673.c: New test.

From-SVN: r254013
This commit is contained in:
H.J. Lu 2017-10-23 15:49:19 +00:00 committed by H.J. Lu
parent df41dbaf7e
commit 66f4014d4b
4 changed files with 28 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2017-10-23 H.J. Lu <hongjiu.lu@intel.com>
PR target/82673
* config/i386/i386.c (ix86_finalize_stack_frame_flags): Skip
DF_REF_INSN if DF_REF_INSN_INFO is false.
2017-10-23 Jan Hubicka <hubicka@ucw.cz>
* i386.c (dimode_scalar_chain::compute_convert_gain): Use

View file

@ -12692,10 +12692,13 @@ ix86_finalize_stack_frame_flags (void)
for (ref = DF_REG_USE_CHAIN (HARD_FRAME_POINTER_REGNUM);
ref; ref = next)
{
rtx_insn *insn = DF_REF_INSN (ref);
next = DF_REF_NEXT_REG (ref);
if (!DF_REF_INSN_INFO (ref))
continue;
/* Make sure the next ref is for a different instruction,
so that we're not affected by the rescan. */
next = DF_REF_NEXT_REG (ref);
rtx_insn *insn = DF_REF_INSN (ref);
while (next && DF_REF_INSN (next) == insn)
next = DF_REF_NEXT_REG (next);

View file

@ -1,3 +1,8 @@
2017-10-23 H.J. Lu <hongjiu.lu@intel.com>
PR target/82673
* gcc.target/i386/pr82673.c: New test.
2017-10-23 Jakub Jelinek <jakub@redhat.com>
* lib/scanasm.exp (dg-function-on-line): Accept optional column info.

View file

@ -0,0 +1,12 @@
/* { dg-do compile } */
/* { dg-options "-O0 -fno-omit-frame-pointer -fvar-tracking-assignments" } */
register long *B asm ("ebp");
long y = 20;
void
bar (void) /* { dg-error "frame pointer required, but reserved" } */
{
B = &y;
} /* { dg-error "bp cannot be used in asm here" } */