Possible bug in XSyncValueSubtract

[email protected]
Newsgroups gmane.comp.freedesktop.xserver
Message-ID <[email protected]>
I think there might be a bug in the XSyncValueSubtract macro in the SYNC 
extension. The following test program demonstrates it: 
 
----- start test program ------ 
 
#include <X11/Xlib.h> 
#include <X11/extensions/sync.h> 
#include <stdlib.h> 
#include <stdio.h> 
#include <unistd.h> 
 
int main() 
{ 
    XSyncValue one, two, res; 
    Bool overflow; 
 
    XSyncIntToValue(&one, 1); 
    XSyncIntToValue(&two, 2); 
 
    XSyncValueSubtract(&res, two, one, &overflow); 
    printf("result=%d:%d\n", res.hi, res.lo); 
    printf("overflow=%d\n", overflow); 
    return 0; 
} 
 
----- end test program ----- 
 
The output of this program should be:  
result=0:1 
overflow=0 
 
Instead, the output I get is: 
result=-1:1 
overflow=1 
 
This bug breaks the semantics of XSyncAwait, causing it to not send 
XSyncCounterNotify events when a trigger is fired and the client is unblocked. 
The bug appears to be present in both the XFree86 code and the KDrive code. 
 
Sincerely, 
    Rayiner Hashem
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.