i386: Skip DF_REF_INSN if DF_REF_INSN_INFO is false
authorH.J. Lu <hongjiu.lu@intel.com>
Mon, 23 Oct 2017 15:49:19 +0000 (15:49 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Mon, 23 Oct 2017 15:49:19 +0000 (08:49 -0700)
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

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr82673.c [new file with mode: 0644]

index be739723a358b0e71a32fd4e16dd14259030d858..ab759abefd30c40b2b57cec012ba67dd2e2f7f79 100644 (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
index b182cc6c0eeaa48ddb272d18932485cea3f006c4..3fafcfe9613947694ce690c4fbc4e19a0533f439 100644 (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);
 
index 3aadb9e8a8954cfc00ba1f3cd7867ee9ddbf640a..f4c09481911884b9c82937dfd39073e3d067720d 100644 (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.
diff --git a/gcc/testsuite/gcc.target/i386/pr82673.c b/gcc/testsuite/gcc.target/i386/pr82673.c
new file mode 100644 (file)
index 0000000..50eb5a3
--- /dev/null
@@ -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" } */