File: gcc11.patch

package info (click to toggle)
mapsembler2 2.2.4%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 7,344 kB
  • sloc: cpp: 51,204; ansic: 13,165; sh: 542; makefile: 394; asm: 271; python: 28
file content (70 lines) | stat: -rw-r--r-- 2,704 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Description: fix ftbfs with gcc 11
 Starting with Gcc 11, ordering relations against pointers are now flagged.
 This is especially useful to spot iterators with types mismatches compared
 to the CPU architecture they run on.  In this particular case, an iterator
 is used on a couple of occasions, and tested against with "less than 0"
 comparisons.  In a few situations the absence of typing might have caused
 issues already, because some occurrences are cast to "long int".  In order
 to match the CPU architecture size, and avoid architecture specific bugs,
 the proper type would more probably be ssize_t.  This type is cast where
 needed.
Author: Étienne Mollier <emollier@debian.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=984226
Forwarded: no
Last-Update: 2021-07-12
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- mapsembler2.orig/kissreads_graph/read_coherence_mapsembler/interface_libchash.cpp
+++ mapsembler2/kissreads_graph/read_coherence_mapsembler/interface_libchash.cpp
@@ -131,7 +131,7 @@
 	 hash_iter iterator=hash_iterator_init(map);
 
 	 /*	 is the hash table empty?  */
-	 if (iterator < 0)
+	 if ((ssize_t)iterator < 0)
 		 return;
 
 	char *key;
@@ -166,7 +166,7 @@
 	 hash_iter iterator=hash_iterator_init(map);
 
 	 /*	 is the hash table empty?  */
-	 if (iterator < 0)
+	 if ((ssize_t)iterator < 0)
 		 return 0;
 
 	char *key;
@@ -194,7 +194,7 @@
 
     /*	 is the hash table empty?  */
     //    printf("freeing from iterator %llx\n", iterator);
-    if ((long int)iterator < 0)
+    if ((ssize_t)iterator < 0)
       return;
 
     char *key;
@@ -263,13 +263,13 @@
 
  hash_iter hash_iterator_is_end(hash_t map, hash_iter iter){
    // 	 return (hash_iter)(iter==NULL || (int)iter == -1);
-   return (hash_iter)(iter==NULL || (long int)iter ==-1);
+   return (hash_iter)(iter==NULL || (ssize_t)iter ==-1);
   }
 
   ssize_t hash_iterator_return_entry(hash_t map, hash_iter iter,
  		char **key, void **data){
  	assert(map != NULL);
- 	assert(iter >= 0);
+ 	assert((ssize_t)iter > 0);
  	assert(key != NULL);
  	assert(data != NULL);
  	if (!hash_iterator_is_end(map, iter))
@@ -520,7 +520,7 @@
 
         // Go through the hashmap Mapped and for each fragment
         // get the reads that have seeds that match somewhere on this fragment
-        if((long int)iterator!=-1){
+        if((ssize_t)iterator!=-1){
                 while(!hash_iterator_is_end(map, iterator)){     // go through all the mapped reads
                         hash_iterator_return_entry(map, iterator, &key, (void**)&mapping_positions); // get key(read) and corresponding mapping positions (pwi)
                         if(mapping_positions){