LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File gsl-wrap.diff of Package gsl (Project home:popinet)

Index: gsl-1.11/sort/Makefile.am
===================================================================
--- gsl-1.11.orig/sort/Makefile.am
+++ gsl-1.11/sort/Makefile.am
@@ -10,7 +10,9 @@ noinst_HEADERS = sortvec_source.c sortve
 TESTS = $(check_PROGRAMS)
 
 check_PROGRAMS = test
 
+#test_source.lo_CFLAGS = -fwrapv
+
 test_SOURCES = test.c
 test_LDADD = libgslsort.la ../permutation/libgslpermutation.la ../vector/libgslvector.la ../block/libgslblock.la ../ieee-utils/libgslieeeutils.la ../err/libgslerr.la ../test/libgsltest.la ../sys/libgslsys.la
 
Index: gsl-1.11/sort/test_source.c
===================================================================
--- gsl-1.11.orig/sort/test_source.c
+++ gsl-1.11/sort/test_source.c
@@ -158,19 +158,19 @@ TYPE (test_sort_vector) (size_t N, size_
 void
 FUNCTION (my, initialize) (TYPE (gsl_vector) * v)
 {
   size_t i;
-  ATOMIC k = 0;
-  volatile ATOMIC kk;
+  ATOMIC maxk = 0;
 
   /* Must be sorted initially */
 
   for (i = 0; i < v->size; i++)
     {
-      kk = k;
-      k++;
-      /* Prevent overflow */
-      if (k < kk) k = kk;
+      ATOMIC k = i;
+      if (k < maxk)	/* prevent wrap around */
+        k = maxk;
+      else
+	maxk = k;
       FUNCTION (gsl_vector, set) (v, i, k);
     }
 }