Bug 45035 - [4.6 Regression] FAIL: gcc.dg/guality/pr36728-2.c
Summary: [4.6 Regression] FAIL: gcc.dg/guality/pr36728-2.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Steven Bosscher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-23 00:33 UTC by H.J. Lu
Modified: 2010-07-24 12:39 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2010-07-23 08:20:29


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2010-07-23 00:33:59 UTC
On Linux/ia32, revision 162431 gave

FAIL: gcc.dg/guality/pr36728-2.c  -O1  line 12 y == 2
FAIL: gcc.dg/guality/pr36728-2.c  -O1  line 14 y == 2

Revision 162427 is OK.
Comment 1 H.J. Lu 2010-07-23 02:32:59 UTC
It is caused by revision 162430:

http://gcc.gnu.org/ml/gcc-cvs/2010-07/msg00784.html
Comment 2 Jakub Jelinek 2010-07-23 07:42:27 UTC
This isn't a mere debug info quality regression, a movl $2, (%esp) is now optimized away, eventhough it is needed by asm volatile following it.

Here is a testcase that at -O1 -m32 now fails at runtime, while it worked well before:

/* PR debug/36728 */
/* { dg-do run } */
/* { dg-options "-O1" } */

int __attribute__((noinline))
foo (int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7)
{
  char x[30];
  int __attribute__ ((aligned(32))) y;

  y = 2;
  asm volatile ("cmpl $2, %0; je 1f; hlt; 1:" : "=m" (y) : "m" (y));
  x[0] = 25;
  asm volatile ("" : "=m" (x[0]) : "m" (x[0]));
  return y;
}

int
main ()
{
  int l = 0;
  asm volatile ("" : "=r" (l) : "0" (l));
  foo (l + 1, l + 2, l + 3, l + 4, l + 5, l + 6, l + 30);
  return 0;
}

The diff is:
@@ -7,7 +7,6 @@ foo:
        movl    %esp, %ebp
        andl    $-32, %esp
        subl    $64, %esp
-       movl    $2, (%esp)
 #APP
 # 12 "PP.c" 1
        cmpl $2, (%esp); je 1f; hlt; 1:
Comment 3 Steven Bosscher 2010-07-23 08:58:20 UTC
Somehow managed to make a mistake in the merge for the case that x_addr is non-NULL.

Index: alias.c
===================================================================
--- alias.c     (revision 162430)
+++ alias.c     (working copy)
@@ -2375,18 +2375,19 @@ true_dependence_1 (const_rtx mem, enum m
     }

   if (! x_addr)
-    x_addr = XEXP (x, 0);
-
-  if (!((GET_CODE (x_addr) == VALUE
-        && GET_CODE (mem_addr) != VALUE
-        && reg_mentioned_p (x_addr, mem_addr))
-       || (GET_CODE (x_addr) != VALUE
-           && GET_CODE (mem_addr) == VALUE
-           && reg_mentioned_p (mem_addr, x_addr))))
     {
-      x_addr = get_addr (x_addr);
-      if (!mem_canonicalized)
-       mem_addr = get_addr (mem_addr);
+      x_addr = XEXP (x, 0);
+      if (!((GET_CODE (x_addr) == VALUE
+            && GET_CODE (mem_addr) != VALUE
+            && reg_mentioned_p (x_addr, mem_addr))
+           || (GET_CODE (x_addr) != VALUE
+               && GET_CODE (mem_addr) == VALUE
+               && reg_mentioned_p (mem_addr, x_addr))))
+       {
+         x_addr = get_addr (x_addr);
+         if (! mem_canonicalized)
+           mem_addr = get_addr (mem_addr);
+       }
     }

   base = find_base_term (x_addr);

Will bootstrap+test, and commit if it passes.
Comment 4 Steven Bosscher 2010-07-24 12:38:07 UTC
Subject: Bug 45035

Author: steven
Date: Sat Jul 24 12:37:51 2010
New Revision: 162499

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162499
Log:
	PR middle-end/45035
	* alias.c (true_dependence_1): Fix thinko in merge of old
	true_dependence and canon_true_dependence.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/alias.c

Comment 5 Steven Bosscher 2010-07-24 12:39:12 UTC
.