Public bug reported:

Binary package hint: tcc

Both div and ldiv give spurious results when compiled with tcc. For
example, the following program:

#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv)
{
    div_t ans = div(27, 10);
    printf("quot = %d; rem = %d\n", ans.quot, ans.rem);
    
    return 0;
}

This should (and does when compiled with gcc) print:
quot = 2; rem = 7
When compiling with tcc I get:
quot = 8; rem = 7

I am running gutsy and was using the tcc that ships with that. I also built and 
installed the version from hardy:
    tcc 0.9.24~cvs20070502-2
Same results.

** Affects: tcc (Ubuntu)
     Importance: Undecided
         Status: New

-- 
C standard library functions div() or ldiv() produces incorrect answers when 
compiled with tcc
https://bugs.launchpad.net/bugs/191452
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to