Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
A boolean should be unsigned if you want to compare it to 1.
authorChristophe Thiéry <christopho128@gmail.com>
Mon, 4 Jun 2012 12:59:13 +0000 (14:59 +0200)
committerChristophe Thiéry <christopho128@gmail.com>
Mon, 4 Jun 2012 13:00:57 +0000 (15:00 +0200)
Without the "unsigned" keyword, the boolean could be either 0 or -1.
This made the Lua tests crash because of a condition "copied == 1".
This bug was introduced by commit 13b40eda ("make it clear that this is a
boolean field").

src/simix/smx_network.c
src/simix/smx_private.h

index da59e87..b1f47fc 100644 (file)
@@ -858,7 +858,7 @@ void SIMIX_comm_copy_data(smx_action_t comm)
 {
   size_t buff_size = comm->comm.src_buff_size;
   /* If there is no data to be copy then return */
-  if (!comm->comm.src_buff || !comm->comm.dst_buff || comm->comm.copied == 1)
+  if (!comm->comm.src_buff || !comm->comm.dst_buff || comm->comm.copied)
     return;
 
   XBT_DEBUG("Copying comm %p data from %s (%p) -> %s (%p) (%zu bytes)",
index 178acd2..cf543db 100644 (file)
@@ -140,7 +140,7 @@ typedef struct s_smx_action {
       void *dst_buff;
       size_t src_buff_size;
       size_t *dst_buff_size;
-      int copied:1;                   /* whether the data were already copied */
+      unsigned int copied:1;          /* whether the data were already copied */
 
       void* src_data;                     /* User data associated to communication */
       void* dst_data;