[Bug target/63661] [4.9/5 Regression] -O2 miscompiles with -mtune=nehalem or corei7

H.J. Lu hjl.tools@gmail.com
Fri Nov 28 14:41:00 GMT 2014


On Fri, Nov 28, 2014 at 3:23 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Fri, Nov 28, 2014 at 11:19:18AM +0000, renlin at gcc dot gnu.org wrote:
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661
>>
>> --- Comment #25 from renlin at gcc dot gnu.org ---
>> Author: renlin
>> Date: Fri Nov 28 11:18:47 2014
>> New Revision: 218144
>>
>> URL: https://gcc.gnu.org/viewcvs?rev=218144&root=gcc&view=rev
>> Log:
>> Use native tune. nehalem is not able to triggle the issue in trunk any more.
>>
>> 2014-11-28  Renlin Li  <renlin.li@arm.com>
>>
>>     PR  target/63661
>>     * gcc.target/i386/pr63661.c: Use native tune.
>>
>> Modified:
>>     trunk/gcc/testsuite/ChangeLog
>>     trunk/gcc/testsuite/gcc.target/i386/pr63661.c
>
> This is wrong.  That will mean the test will do something different
> for different testers.  If it reproduces for you with
> -mtune=native, just find out what that -mtune=native is for you
> (use -v) and try the specific option instead.
>
>         Jakub

I checked in this patch to use  -mtune=nehalem.  Verified
on Linux/x86-64 with -m32 and -m64.  When I reverted r217783,
the modified test failed.


-- 
H.J.
---
Index: ChangeLog
===================================================================
--- ChangeLog (revision 218156)
+++ ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2014-11-28  H.J. Lu  <hongjiu.lu@intel.com>
+
+ * gcc.target/i386/pr63661.c: Replace -mtune=native with
+ -mtune=nehalem.
+ (foo): Replace "!=" with delta.
+ (main): Remove __builtin_printf.
+
 2014-11-28  Renlin Li  <renlin.li@arm.com>

  PR target/63661
Index: gcc.target/i386/pr63661.c
===================================================================
--- gcc.target/i386/pr63661.c (revision 218156)
+++ gcc.target/i386/pr63661.c (working copy)
@@ -1,7 +1,7 @@
 /* PR target/63661 */
 /* { dg-do run } */
 /* { dg-require-effective-target fpic } */
-/* { dg-options "-mtune=native -fPIC -O2" } */
+/* { dg-options "-mtune=nehalem -fPIC -O2" } */

 static void __attribute__((noinline,noclone,hot))
 foo (double a, double q, double *ff, double *gx, int e, int ni)
@@ -11,11 +11,15 @@
       double n;
       unsigned long long o;
     } punner;
+  double d;

   punner.n = q;
    __builtin_printf("B: 0x%016llx ---- %g\n", punner.o, q);

-  if(q != 5)
+  d = q - 5;
+  if(d < 0)
+    d = -d;
+  if (d > 0.1)
     __builtin_abort();
 }

@@ -71,7 +75,6 @@
 {
   double c[1000];

-  __builtin_printf("A: 0x%016llx\n", (unsigned long long)c);
   bar (1, 5.0, c);
   return 0;
 }



More information about the Gcc-patches mailing list