http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55845



--- Comment #3 from Vladimir Yakovlev <vbyakovl23 at gmail dot com> 2013-01-04 
06:40:44 UTC ---

The test fails corei7-avx also. I build a simple reproducer.



-------------------------------------------------------------

#include <stdio.h>



#define N 100



double

foo ( 

   int      size, 

   double   y[], 

   double   x[] 

)

{

  double sum = 0.0 ;

  int i ;

  for (i = 0, sum = 0. ; i < size ; i++)

    sum += y[i] * x[i] ; 

  return(sum);

}



int main ()

{

  double x[N];

  double y[N];

  double s;

  int i;



  for (i = 0; i < N; i++)

    {

      x[i] = i;

      y[i] = i;

    }



  s = foo (N, y, x);



  printf("%s\n", s == 328350 ? "pass" : "fail");

}

------------------------------------------------------



$ gcc -mavx -g -static  -o t  -O3 -ffast-math -march=corei7 t.c -fno-inline &&

./t

pass

$ gcc  -fschedule-insns -mavx -g -static  -o t  -O3 -ffast-math -march=corei7

t.c -fno-inline && ./t                                                          

fail



Responsible phase is jump2. To switch off the phase I did changes



diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c

index 5d142e9..be04c5d 100644

--- a/gcc/cfgcleanup.c

+++ b/gcc/cfgcleanup.c

@@ -3070,6 +3070,7 @@ struct rtl_opt_pass pass_jump =

 static unsigned int

 execute_jump2 (void)

 {

+  if (!getenv("NOJMP2"))

   cleanup_cfg (flag_crossjumping ? CLEANUP_CROSSJUMP : 0);

   return 0;

 }



env NOJMP2=1 gcc  -fschedule-insns -mavx -g -static  -o t  -O3 -ffast-math

-march=corei7 t.c -fno-inline && ./t

pass



I used compiler

Target: x86_64-unknown-linux-gnu

Configured with: ../gcc/configure CFLAGS='-O0 -g3' CXXFLAGS='-O0 -g3'

--prefix=/gnumnt/msticlxl16_users/vbyakovl/workspaces/gcc/install

--enable-clocale=gnu --disable-bootstrap --with-system-zlib --enable-shared

--with-demangler-in-ld --with-fpmath=sse --with-arch=corei7-avx

--with-cpu=corei7-avx --enable-languages=c,c++,fortran,java,lto,objc

--no-create --no-recursion

Reply via email to